This repository was archived by the owner on Feb 8, 2024. It is now read-only.
v0.12.0 🌤
Features
- Added scope creator for
.resources()
#11 3fecc44
const routes = createRest(root => {
// GET /users -> index()
// POST /users -> create()
// GET /users/:userId -> read()
// PUT /users/:userId -> update()
// PATCH /users/:userId -> patch()
// DELETE /users/:userId -> destroy()
root.resources('users', UsersController, {}, users => {
// GET /users/latests -> latest()
users.get('latest', UsersController.latest)
users.scope(':userId', userId => {
// GET /users/:userId/bio -> read()
// POST /users/:userId/bio -> create()
// PUT /users/:userId/bio -> update()
// DELETE /users/:userId/bio -> delete()
userId.crud('bio', UserBioController)
// And you can nest resources:
// GET /users/:userId/photos/ -> index()
// POST /users/:userId/photos/ -> create()
// GET /users/:userId/photos/:photoId -> read()
// PUT /users/:userId/photos/:photoId -> update()
// PATCH /users/:userId/photos/:photoId -> patch()
// DELETE /users/:userId/photos/:photoId -> destroy()
userId.resources('photos', PhotosController)
})
})
})
Chore
- Add coveralls token for createrest-koa 15cb5ca