You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.
I was reading through the code for this https://github.com/visionmedia/express-resource and realised it would be useful to have a function that lets you define a set of default routes for a module.
e.g. from the site above we could do the following for an API module
module.route.defaultResource() >>
GET /forums -> index
GET /forums/new -> new
POST /forums -> create
GET /forums/:forum -> show
GET /forums/:forum/edit -> edit
PUT /forums/:forum -> update
DELETE /forums/:forum -> destroy
Where each of the functions on the right would need to be defined (and exported - which is a change) by the module.
We could also add a non-restful version to degrade to default:
module.route.default() >> fn / template / block
GET /forums -> index / index.html / content.forums.index etc.
GET /forums/new -> new
POST /forums -> create
GET /forums/:forum -> show
GET /forums/:forum/edit -> edit
POST /forums/:forum -> update
GET /forums/:forum/delete -> destroy
You could then add additional, complex routes on top.
module.route.defaultAdmin() >>
GET /admin/module/forums -> admin / admin.html / admin.modules.forums etc.
POST /admin/module/forums -> adminUpdate
... ? You would need to pass things in (e.g. like a map of permissions to routes).
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I was reading through the code for this https://github.com/visionmedia/express-resource and realised it would be useful to have a function that lets you define a set of default routes for a module.
e.g. from the site above we could do the following for an API module
module.route.defaultResource() >>
GET /forums -> index
GET /forums/new -> new
POST /forums -> create
GET /forums/:forum -> show
GET /forums/:forum/edit -> edit
PUT /forums/:forum -> update
DELETE /forums/:forum -> destroy
Where each of the functions on the right would need to be defined (and exported - which is a change) by the module.
We could also add a non-restful version to degrade to default:
module.route.default() >> fn / template / block
GET /forums -> index / index.html / content.forums.index etc.
GET /forums/new -> new
POST /forums -> create
GET /forums/:forum -> show
GET /forums/:forum/edit -> edit
POST /forums/:forum -> update
GET /forums/:forum/delete -> destroy
You could then add additional, complex routes on top.
module.route.defaultAdmin() >>
GET /admin/module/forums -> admin / admin.html / admin.modules.forums etc.
POST /admin/module/forums -> adminUpdate
... ? You would need to pass things in (e.g. like a map of permissions to routes).
The text was updated successfully, but these errors were encountered: