crud
Closed this issue · 1 comments
sergeysova commented
Object controller
const Books = {
beforeEach() {}, // invoked before each handler
afterEach() {}, // invoked after each handler
index() {}, // GET /books
create() {}, // POST /books
read() {}, // GET /books/:bookId
update() {}, // PUT /books/:bookId
patch() {}, // PATCH /books/:bookId
destroy() {}, // DELETE /books/:bookId
// of no patch() provided, PATCH use update()
}
createRest(root => {
root.crud('books', Books)
})
sergeysova commented
Class controller
class Books {
constructor() {} // invoked when request is accepted
// before invoke beforeEach()
beforeEach() {} // invoked before each handler
afterEach() {} // invoked after each handler
index() {} // GET /books
create() {} // POST /books
read() {} // GET /books/:bookId
update() {} // PUT /books/:bookId
patch() {} // PATCH /books/:bookId
destroy() {} // DELETE /books/:bookId
// of no patch() provided, PATCH use update()
}
createRest(root => {
root.crud('books', Books)
})
???