53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
/**
|
|
* @module flitter-auth/deploy/routing/routers/auth
|
|
*/
|
|
|
|
/**
|
|
* These are the route definitions for Flitter-auth.
|
|
* @type {Object}
|
|
*/
|
|
module.exports = exports = {
|
|
|
|
/*
|
|
* Define the prefix applied to each of these routes.
|
|
* For example, if prefix is '/auth':
|
|
* '/' becomes '/auth'
|
|
* '/login' becomes '/auth/login'
|
|
*/
|
|
prefix: '/auth',
|
|
|
|
/*
|
|
* Define GET routes.
|
|
* These routes are registered as GET methods.
|
|
* Handlers for these routes should be specified as
|
|
* an array of functions that are applied in order.
|
|
*
|
|
* mw() calls apply Flitter middleware
|
|
* controller() calls get methods in Flitter controllers
|
|
*/
|
|
get: {
|
|
'/register': [ _flitter.mw('auth:RequireGuest'), _flitter.controller('Auth').register_get ],
|
|
'/login': [ _flitter.mw('auth:RequireGuest'), _flitter.controller('Auth').login_get ],
|
|
'/logout': [ _flitter.mw('auth:RequireAuth'), _flitter.controller('Auth').logout ],
|
|
|
|
/*
|
|
* A placeholder dashboard.
|
|
*/
|
|
'/dash': [ _flitter.mw('auth:RequireAuth'), _flitter.controller('Auth').dash_get ]
|
|
},
|
|
|
|
/*
|
|
* Define POST routes.
|
|
* These routes are registered as POST methods.
|
|
* Handlers for these routes should be specified as
|
|
* an array of functions that are applied in order.
|
|
*
|
|
* mw() calls apply Flitter middleware
|
|
* controller() calls get methods in Flitter controllers
|
|
*/
|
|
post: {
|
|
'/register': [ _flitter.mw('auth:RequireGuest'), _flitter.controller('Auth').register_post ],
|
|
'/login': [ _flitter.mw('auth:RequireGuest'), _flitter.controller('Auth').login_post ],
|
|
},
|
|
}
|