Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var _ = require('underscore'),
keystone = require('keystone'),
middleware = require('./middleware'),
importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initErrorHandlers);
keystone.pre('routes', middleware.initLocals);
keystone.pre('routes', middleware.loadSponsors);
keystone.pre('render', middleware.flashMessages);
// Handle 404 errors
keystone.set('404', function(req, res, next) {
res.notfound();
});
// Handle other errors
keystone.set('500', function(err, req, res, next) {
var title, message;
if (err instanceof Error) {
var keystone = require('keystone'),
_ = require('underscore'),
globals = require('../lib/globals'),
middleware = require('./middleware'),
importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initErrorHandlers);
keystone.pre('routes', middleware.init);
keystone.pre('routes', middleware.loadTags);
keystone.pre('routes', middleware.countTopics);
keystone.pre('render', middleware.flashMessages);
// Handle 404 errors
keystone.set('404', function(req, res, next) {
res.notfound();
});
// Handle other errors
keystone.set('500', function(err, req, res, next) {
var title, message;
*
* Each of these files is a route controller, and is responsible for all the
* processing that needs to happen for the route (e.g. loading data, handling
* form submissions, rendering the view template, etc).
*
* Bind each route pattern your application should respond to in the function
* that is exported from this module, following the examples below.
*
* See the Express application routing documentation for more information:
* http://expressjs.com/api.html#app.VERB
*/
var _ = require('lodash'),
keystone = require('keystone'),
middleware = require('./middleware'),
importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
// Import Route Controllers
var routes = {
views: importRoutes('./views'),
api: importRoutes('./api'),
ang_mat: importRoutes('./ang_mat'),
ang_bootm: importRoutes('./ang_bootm')
};
// Setup Route Bindings
exports = module.exports = function(app) {
var keystone = require('keystone');
var importRoutes = keystone.importer(__dirname);
var routes = {
api: importRoutes('./api')
};
// Setup Route Bindings
exports = module.exports = function(app) {
app.get('/bill/list', keystone.middleware.api, routes.api.bill.list);
app.get('/bill/search', keystone.middleware.api, routes.api.bill.search);
app.get('/bill/:legislature/:number', keystone.middleware.api, routes.api.bill.get);
};
* in its own file, and we import all the files in the /routes/views directory.
*
* Each of these files is a route controller, and is responsible for all the
* processing that needs to happen for the route (e.g. loading data, handling
* form submissions, rendering the view template, etc).
*
* Bind each route pattern your application should respond to in the function
* that is exported from this module, following the examples below.
*
* See the Express application routing documentation for more information:
* http://expressjs.com/api.html#app.VERB
*/
var keystone = require('keystone');
var middleware = require('./middleware');
var importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
// Import Route Controllers
var routes = {
views: importRoutes('./views')
};
// Setup Route Bindings
exports = module.exports = function(app) {
// Views
app.get('/', routes.views.index);
app.get('/blog/:category?', routes.views.blog);
var keystone = require('keystone');
var middleware = require('./middleware');
var importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
// Import Route Controllers
var routes = {
views: importRoutes('./views')
};
// Setup Route Bindings
exports = module.exports = function(app) {
// Views
app.get('/', routes.views.index);
app.get('/blog/:category?', routes.views.blog);
* in its own file, and we import all the files in the /routes/views directory.
*
* Each of these files is a route controller, and is responsible for all the
* processing that needs to happen for the route (e.g. loading data, handling
* form submissions, rendering the view template, etc).
*
* Bind each route pattern your application should respond to in the function
* that is exported from this module, following the examples below.
*
* See the Express application routing documentation for more information:
* http://expressjs.com/api.html#app.VERB
*/
var keystone = require('keystone');
var middleware = require('./middleware');
var importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
// Import Route Controllers
var routes = {
views: importRoutes('./views'),
};
// Setup Route Bindings
exports = module.exports = function (app) {
// Views
// app.get('/', routes.views.index);
// app.get('/blog/:category?', routes.views.blog);
// app.get('/blog/post/:post', routes.views.post);
* in its own file, and we import all the files in the /routes/views directory.
*
* Each of these files is a route controller, and is responsible for all the
* processing that needs to happen for the route (e.g. loading data, handling
* form submissions, rendering the view template, etc).
*
* Bind each route pattern your application should respond to in the function
* that is exported from this module, following the examples below.
*
* See the Express application routing documentation for more information:
* http://expressjs.com/api.html#app.VERB
*/
var keystone = require('keystone');
var middleware = require('./middleware');
var importRoutes = keystone.importer(__dirname);
// Common Middleware
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
// Import Route Controllers
var routes = {};
// Setup Route Bindings
module.exports = function(app) {
var rest = require('./rest');
};
var keystone = require('keystone');
var passport = require('passport');
var config = require('/opt/cocorico/api-web/config.json');
var importRoutes = keystone.importer(__dirname);
var routes = {
api: importRoutes('./api'),
};
function isAuthenticated(req, res, next) {
if (!req.isAuthenticated() || !req.user.sub)
return res.status(401).apiResponse({error: 'not authenticated'});
return next();
}
// Setup Route Bindings
exports = module.exports = function(app) {
app.use(passport.initialize());
app.use(passport.session());