Last active
February 12, 2017 16:28
-
-
Save vincentbel/6a7d35e6a2999e2aa90d065a77831bfd to your computer and use it in GitHub Desktop.
Chainable route example of [service-mocker](https://github.com/service-mocker/service-mocker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createServer } from 'service-mocker' | |
| import createRoutes from './routes/' | |
| const server = createServer() | |
| createRoutes(server.router) | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import createUserRoutes from './user' | |
| export default router => { | |
| router.get('/', 'hello world') | |
| // user routes | |
| const userRouter = router.base('/users') | |
| createUserRoutes(userRouter) | |
| // ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import userController from '../controllers/user' | |
| export default router => { | |
| router.get('/', userController.list) | |
| router.post('/', userController.create) | |
| // ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
routes/user.js
I'd like to code as: