Methods

getRoutes(dir, files) → {Array.<String>}

Return list of route files for a given directory.

Parameters:
NameTypeDescription
dirString

Files directory.

filesArray

List of files (optional).

Returns:
Type: 
Array.<String>

loadRoutes(router)

Load routes from a pre-configured directory.

Parameters:
NameTypeDescription
routerRouter

Router instance.

module:router/Route()

Handle routing operations for the given Route.

Example
// .. sam-app/src/routes/foo.js
const routeConfig = {
  middleware: [middlewareFunc1, middlewareFunc2],
  resource: true || ['get', 'put', 'patch', 'submit'],

  index  (req, res) {},
  get    (req, res, id) {},
  create (req, res) {},
  put    (req, res, id) {},
  update (req, res) {},
  patch  (req, res, id) {},
  post   (req, res) {},
  submit (req, res, id) {},
  delete (req, res, id) {}
};

module.exports = routeConfig;