createrest
Docs at https://createrest.js.org
Usage example
// routes.jsconst createRest printRoutes = const before1 = { console }const before2 = { console }const before3 = { console }const after1 = { console }const after2 = { console }const after3 = { console }const post1 = { console }const get1 = { console }const get2 = { console }const put3 = { console } const ExampleController = { console } {} {} {} {} {} const BooksController = { console } {} {} {} {} {} {} {} const routes = moduleexports = routes
Express
More in it's repo createrest-express
const createRestExpress = const express = const routes = const app = app app
Koa
More in it's repo createrest-koa
const Koa = const createKoaRouter = const routes = const app = const router = app app
Output:
POST / -> before1(), post1(), after1()
GET /demo/ -> before1(), before2(), get1(), after2(), after1()
GET /demo/foo/ -> before1(), before2(), get2(), after2(), after1()
PUT /demo/bar/ -> before1(), before2(), before3(), put3(), after3(), after2(), after1()
GET /demo/bar/example/ -> before1(), before2(), before3(), beforeEach(), read(), afterEach(), after3(), after2(), after1()
POST /demo/bar/example/ -> before1(), before2(), before3(), beforeEach(), create(), afterEach(), after3(), after2(), after1()
PUT /demo/bar/example/ -> before1(), before2(), before3(), beforeEach(), update(), afterEach(), after3(), after2(), after1()
DELETE /demo/bar/example/ -> before1(), before2(), before3(), beforeEach(), destroy(), afterEach(), after3(), after2(), after1()
GET /books/ -> before1(), beforeEach(), index(), afterEach(), after1()
POST /books/ -> before1(), beforeEach(), create(), afterEach(), after1()
GET /books/:bookId/ -> before1(), beforeEach(), read(), afterEach(), after1()
PUT /books/:bookId/ -> before1(), beforeEach(), update(), afterEach(), after1()
PATCH /books/:bookId/ -> before1(), beforeEach(), patch(), afterEach(), after1()
DELETE /books/:bookId/ -> before1(), beforeEach(), destroy(), afterEach(), after1()