Developing a plugin with endpoints

I found a solution, but it doesn’t seem very documentede anywhere.

Solution:

module.exports = {
  'content-api': {
  type: 'content-api',
  routes: [
    {
      method: 'GET',
      path: '/',
      handler: 'myController.index',
      config: {
        policies: [],
      },
    },
  ]
}};

Before:

module.exports = [
  {
    method: 'GET',
    path: '/',
    handler: 'myController.index',
    config: {
      policies: [],
    },
  },
];

3 Likes