2020-04-16 20:38:01 +00:00
|
|
|
/*
|
|
|
|
* Index Routes
|
|
|
|
* -------------------------------------------------------------
|
|
|
|
* This is a sample routes file. Routes and their handlers should be
|
|
|
|
* defined here, but no logic should occur.
|
|
|
|
*/
|
|
|
|
const index = {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define the prefix applied to each of these routes.
|
|
|
|
* For example, if prefix is '/auth':
|
|
|
|
* '/' becomes '/auth'
|
|
|
|
* '/login' becomes '/auth/login'
|
|
|
|
*/
|
|
|
|
prefix: '/',
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define middleware that should be applied to all
|
|
|
|
* routes defined in this file. Middleware should be
|
|
|
|
* included using its non-prefixed canonical name.
|
|
|
|
*
|
|
|
|
* You can pass arguments along to a middleware by
|
|
|
|
* specifying it as an array where the first element
|
|
|
|
* is the canonical name of the middleware and the
|
|
|
|
* second element is the argument passed to the
|
|
|
|
* handler's exec() method.
|
|
|
|
*/
|
|
|
|
middleware: [
|
|
|
|
// 'MiddlewareName', // Or without arguments
|
|
|
|
],
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define GET routes.
|
|
|
|
* These routes are registered as GET methods.
|
|
|
|
* Handlers for these routes should be specified as
|
|
|
|
* an array of canonical references to controller methods
|
|
|
|
* or middleware that are applied in order.
|
|
|
|
*/
|
|
|
|
get: {
|
|
|
|
// handlers should be a list of either controller:: or middleware:: references
|
|
|
|
// e.g. middleware::HomeLogger
|
|
|
|
// e.g. controller::Home.welcome
|
|
|
|
'/': [ 'controller::Home.welcome' ],
|
|
|
|
|
|
|
|
// Placeholder for auth dashboard. You'd replace this with
|
|
|
|
// your own route protected by 'middleware::auth:UserOnly'
|
2020-05-04 01:16:54 +00:00
|
|
|
'/dash': [ 'middleware::auth:UserOnly', ['middleware::Redirect', {to: '/dash/profile'}] ],
|
2020-04-22 14:19:25 +00:00
|
|
|
|
2020-05-04 01:16:54 +00:00
|
|
|
// TODO remove this
|
|
|
|
'/tmpl': [ 'middleware::auth:UserOnly', 'controller::Home.tmpl' ],
|
2020-04-16 20:38:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define POST routes.
|
|
|
|
* These routes are registered as POST methods.
|
|
|
|
* Handlers for these routes should be specified as
|
|
|
|
* an array of canonical references to controller methods
|
|
|
|
* or middleware that are applied in order.
|
|
|
|
*/
|
|
|
|
post: {
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = index
|