67 |
static delete(path: string, callback: [typeof Controller, string]) { |
static delete(path: string, callback: [typeof Controller, string]) { |
68 |
return Router.insert("DELETE", path, callback); |
return Router.insert("DELETE", path, callback); |
69 |
} |
} |
70 |
|
|
71 |
|
static resource(path: string, controller: typeof Controller, { get = true, post = true, put = true, patch = true, del = true }: { get?: boolean, post?: boolean, put?: boolean, patch?: boolean, del?: boolean } = {}) { |
72 |
|
return { |
73 |
|
get: get ? Router.get(path, [controller, 'index']) : undefined, |
74 |
|
post: post ? Router.post(path, [controller, 'create']) : undefined, |
75 |
|
put: put ? Router.put(path, [controller, 'update']) : undefined, |
76 |
|
patch: patch ? Router.patch(path, [controller, 'update']) : undefined, |
77 |
|
delete: del ? Router.delete(path, [controller, 'delete']) : undefined, |
78 |
|
}; |
79 |
|
} |
80 |
} |
} |