Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 11, 2020 10:05
Show Gist options
  • Select an option

  • Save PatrickKalkman/b2d4d1aec152d858e75ad1beeb657165 to your computer and use it in GitHub Desktop.

Select an option

Save PatrickKalkman/b2d4d1aec152d858e75ad1beeb657165 to your computer and use it in GitHub Desktop.
Routes definition for Fastify using fastify-register-routes
const jobController = require('../controllers/jobController');
const jobRoutes = [
{
name: 'GetJobs',
method: 'get',
path: '/api/jobs',
handler: jobController.getJobs,
},
{
name: 'GetJobs',
method: 'get',
path: '/api/jobs/:id',
handler: jobController.getJob,
},
{
name: 'AddJob',
method: 'post',
path: '/api/jobs',
handler: jobController.addJob,
},
{
name: 'UpdateJob',
method: 'put',
path: '/api/jobs/:id',
handler: jobController.updateJob,
},
{
name: 'DeleteJob',
method: 'delete',
path: '/api/jobs/:id',
handler: jobController.deleteJob,
},
];
module.exports = jobRoutes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment