New API Routes

Every API Version has it's own routes directory

Declaring your API routes

Inside your routes folder there are API versions for each route verb

To declare a route, add a object in that verb file. Example: ./routes/v1/get.js

const { v1 } = require('../../controllers');
const { yourMiddleware } = require('../../middleware');

module.exports = [
{
route: '/',
middleware: [
// if no middleware needed, leave the array empty
{ 'The name of your middleware for the API docs': yourMiddleware },
],
controller: v1.yourControllerDirectory.yourControllerFile,
description: '',
// Optional: If you do not want the API endpoint on the docs
ignore: true,
},
];

Your Routes Directory

Starting with the API Version

Each directory is setup with an api version. Example: v1, v2, etc.

/routes /v1 /get.js /patch.js /post.js /put.js /delete.js

New API Versions

When you make a new api version it will have its own route files for that version only

/routes /v2 /get.js /patch.js /post.js /put.js /delete.js