Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mainHash = 'ad807fa5016f97e62e7d';
const vendorHash = '158ebf10428e11d2ccc7';
import React from 'react';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import { Provider } from 'react-redux';
import store from '../app/src/store/store.js';
import { routes } from '../app/src/utils/routes.jsx';
const serverApiRoutes = {
api: importRoutes('./api')
};
if (isDeveloping) {
keystone.pre('routes', webpackMiddleware(compiler, {
noInfo: true,
publicPath: config.output.publicPath
}));
keystone.pre('routes', webpackHotMiddleware(compiler, {
log: console.log // eslint-disable-line
}));
}
exports = module.exports = function (app) {
app.use(webpackMiddleware(compiler, {
noInfo: true,
publicPath: config.output.publicPath
}));
app.use(webpackHotMiddleware(compiler, {
* http://expressjs.com/api.html#app.VERB
*/
var keystone = require('keystone');
var middleware = require('./middleware');
var importRoutes = keystone.importer(__dirname);
var exec = require('child_process').exec;
var fs = require('fs');
var async = require('async');
//var Promise = require('node-promise'); //Promises to handle asynchonous callbacks.
var Promise = require('mpromise');
// Common Middleware
keystone.pre('routes', middleware.initLocals);
keystone.pre('render', middleware.flashMessages);
// Import Route Controllers
var routes = {
views: importRoutes('./views'),
api: importRoutes('./api')
};
// 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);
app.get('/gallery', routes.views.gallery);
app.all('/contact', routes.views.contact);
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) {
message = err.message;
err = err.stack;
}
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;
if (err instanceof Error) {
message = err.message;
err = err.stack;
* 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);
// app.get('/gallery', routes.views.gallery);
// NOTE: To protect a route so that only admins can see it, use the requireUser middleware:
// app.get('/protected', middleware.requireUser, routes.views.protected);
exports = module.exports = app => {
// before any route, load in the locals
keystone.pre('routes', initLocals);
// redirects
Object.keys(redirectData)
.forEach((key) => app.get(`/${key}`, controllers.view.redirect));
/*****************************************
*****************************************
API Routes
*****************************************
*****************************************/
if(authOn) {
app.post('/api/login', controllers.login.loginAction);
app.all('/api/logout', controllers.login.logoutAction);
// login page view route