Skip to content

Routing

Glad JS edited this page Oct 14, 2017 · 1 revision

In the routes folder file you will find your routes. The routes object is organized by request method.

  module.exports = {
    GET: [{
        path: '/users',         // <--- what url does this entry match?
        action: 'GET',          // <--- what controller method should handle this request?
        policy: 'authenticated' // <--- what policy applies to this route?
    },{
        path: '/users/:id',
        action: 'findOne',
        policy: 'resourceOwnerOrAdmin' // <--- Not built in, but in the policies example above.
    }],

    POST: [{
        path: '/users',
        action: 'POST',
        policy: 'authenticated'
    }],

    PUT: [{
        path: '/users/:id',
        action: 'PUT',
        policy: 'authenticated'
    }],

    DELETE: [{
        path: '/users/:id',
        action: 'DELETE',
        policy: 'authenticated'
    }]
  }

If you need to override the default body parser or the max body limit you can do this per endpoint.

bodyParser : {
  limit : '10kb',
  parser : 'json'
}

Clone this wiki locally