Beispiel #1
0
	function initSites(app, database, options) {
		options = options || {};
		var host = options.host;
		var templatesPath = options.templatesPath;
		var partialsPath = options.partialsPath;
		var themesPath = options.themesPath;
		var siteTemplatePath = options.siteTemplatePath;
		var siteAuthOptions = options.siteAuthOptions;
		var adminAssetsUrl = options.adminAssetsUrl;
		var themesUrl = options.themesUrl;
		var adapters = options.adapters;
		var uploadAdapter = options.uploadAdapter;
		var sessionMiddleware = options.sessionMiddleware;
		var analyticsConfig = options.analytics;

		app.use('/canvases', composeMiddleware([
			ensureAuth('/login'),
			sitesApp(database, {
				host: host,
				templatesPath: templatesPath,
				partialsPath: partialsPath,
				themesPath: themesPath,
				siteTemplatePath: siteTemplatePath,
				siteAuthOptions: siteAuthOptions,
				adminAssetsUrl: adminAssetsUrl,
				themesUrl: themesUrl,
				adapters: adapters,
				uploadAdapter: uploadAdapter,
				sessionMiddleware: sessionMiddleware,
				analytics: analyticsConfig
			})
		]));
	}
Beispiel #2
0
	function initAdapters(app, database, options) {
		options = options || {};
		var host = options.host;
		var adapters = options.adapters;

		app.use('/adapters', composeMiddleware([
			ensureAuth('/login'),
			adaptersApp(database, {
				host: host,
				adapters: adapters
			})
		]));
	}
Beispiel #3
0
	function initSupport(app, options) {
		options = options || {};
		var templatesPath = options.templatesPath;
		var partialsPath = options.partialsPath;
		var sessionMiddleware = options.sessionMiddleware;
		var analyticsConfig = options.analytics;

		app.use('/support', composeMiddleware([
			ensureAuth('/login'),
			supportApp({
				templatesPath: templatesPath,
				partialsPath: partialsPath,
				sessionMiddleware: sessionMiddleware,
				analytics: analyticsConfig
			})
		]));
	}
Beispiel #4
0
	function initAccount(app, database, options) {
		options = options || {};
		var templatesPath = options.templatesPath;
		var partialsPath = options.partialsPath;
		var sessionMiddleware = options.sessionMiddleware;
		var adapters = options.adapters;
		var analyticsConfig = options.analytics;

		app.use('/account', composeMiddleware([
			ensureAuth('/login'),
			accountApp(database, {
				templatesPath: templatesPath,
				partialsPath: partialsPath,
				adapters: adapters,
				sessionMiddleware: sessionMiddleware,
				analytics: analyticsConfig
			})
		]));
	}
Beispiel #5
0
	function initPreview(app, database, cache, options) {
		options = options || {};
		var host = options.host;
		var themesPath = options.themesPath;
		var themesUrl = options.themesUrl;
		var themeAssetsUrl = options.themeAssetsUrl;
		var adaptersConfig = options.adaptersConfig;
		var analyticsConfig = options.analytics;

		app.use('/preview', composeMiddleware([
			ensureAuth('/login'),
			previewApp(database, cache, {
				host: host,
				themesPath: themesPath,
				themesUrl: themesUrl,
				themeAssetsUrl: themeAssetsUrl,
				adaptersConfig: adaptersConfig,
				analytics: analyticsConfig
			})
		]));
	}
Beispiel #6
0
exports.loginMiddleware = function() {
  return compose([verifyLogin, setSessionCookie]);
};
Beispiel #7
0
exports.registerMiddleware = function() {
  return compose([verifyAndRegister, setSessionCookie]);
};
Beispiel #8
0
import webpack from 'webpack'
import { compose } from 'compose-middleware'
import WebpackDevMiddleware from 'webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware'
import webpackConfig from '../../../../build/webpack'

const bundler = webpack(webpackConfig)

export default compose([
  WebpackDevMiddleware(bundler, webpackConfig.devServer),
  WebpackHotMiddleware(bundler)
])
import { compose } from 'compose-middleware';
import fileUploadMiddleware from '../files/file-upload.middleware';
import mapViewService from './map-view.service';

export default {
    uploadPicture: compose(fileUploadMiddleware, onFileUploaded)
};

function onFileUploaded(req, { send }, next) {

    const { id } = req.params;
    const { filename } = req.file;

    mapViewService.updatePicture(id, filename)
        .then(send)
        .catch(next);
}