ashleygwilliams/ashleygwilliams.github.io

View on GitHub
app/modules/writing/routes.js

Summary

Maintainability
B
6 hrs
Test Coverage
const controller = require('./controller');
const schema = require('./schema');

module.exports = {
  post: {
    '/': controller.create({
      schema: schema
    }),
    '/:id/links/:relation': controller.update()
  },
  get: {
    '/': controller.read(),
    '/:id': controller.read(),
    '/:id/:related': controller.read(),
    '/:id/links/:relation': controller.read()
  },
  patch: {
    '/:id': controller.update({
      schema: schema
    }),
    '/:id/links/:relation': controller.update()
  },
  delete: {
    '/:id': controller.destroy(),
    '/:id/links/:relation': controller.update()
  }
};