How to use the keystone.init function in keystone

To help you get started, we’ve selected a few keystone examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keycircle / keyuxt / server / index.js View on Github external
import keystone from 'keystone'
import _ from 'lodash'
import server from './server'

keystone.init({
  name: 'Keystone Boilerplate',
  brand: 'Keystone Boilerplate',
  static: 'public',
  logger: ':method :url :status :response-time ms - :res[content-length]',
  'auto update': false,
  session: true,
  auth: true,
  'user model': 'User',
  compress: true,
  headless: false // true to disable admin
})

keystone.import('../server/models')

keystone.set('locals', {
  _,
github FlintMade / react-keystone-boilerplate / source / server / server.js View on Github external
// Keystone import
import Keystone from 'keystone';
import cookieParser from 'cookie-parser';

import { ReduxRouter } from 'redux-router';
import createHistory from 'history/lib/createMemoryHistory';
import { reduxReactRouter, match } from 'redux-router/server';
import { Provider } from 'react-redux';
import qs from 'query-string';
import getRoutes from '../routes';
import getStatusFromRoutes from '../helpers/getStatusFromRoutes';

const pretty = new PrettyError();

Keystone.init({
  'name': config.app.title,
  'brand': config.app.title,
  'signin logo': ['/logo.jpg', 100, 100],
  'view engine': 'jade',
  'emails': 'templates/emails',
  'session': false,
  'updates': 'updates',
  'auth': true,
  'user model': 'User',
  'auto update': true,
  'cookie secret': process.env.COOKIE_SECRET,
  'headless': process.env.DISABLE_KEYSTONE
});
Keystone.set('routes', require('./routes'));
Keystone.set('port', config.port);
Keystone.import('models');
github internetErik / keystone4-universal-react / server / index.js View on Github external
if(process.env.NODE_ENV === 'production') {
  // keystoneInit['ssl port'] = process.env.SSL_PORT || 443;
  // keystoneInit['ssl'] = 'force';
  // keystoneInit['ssl key'] = process.env.SSL_KEY || '/etc/letsencrypt/live/test.org/privkey.pem';
  // keystoneInit['ssl cert'] = process.env.SSL_CERT || '/etc/letsencrypt/live/test.org/fullchain.pem';

  // This automatic letsencrypt isn't working right now for me
  // keystoneInit['letsencrypt'] = {
  //   email: 'email@test.com',
  //   domains: ['www.test.com', 'test.com'],
  //   register: true,
  //   tos: true,
  // };
}

keystone.init(keystoneInit);

// Load your project's Models
keystone.import('models');

// Setup common locals for your templates. The following are required for the
// bundled templates and layouts. Any runtime locals (that should be set uniquely
// for each request) should be added to ./routes/middleware.js
keystone.set('locals', {
  _: require('lodash'),
  env: keystone.get('env'),
  utils: keystone.utils,
  editable: keystone.content.editable,
});

// Load your project's Routes
keystone.set('routes', require('./routes'));
github keystonejs / keystone-test-project / keystone.js View on Github external
require('dotenv').config();

var keystone = require('keystone');
var config = require('./config');

keystone.init(config.options);
keystone.import('models');
keystone.set('locals', config.locals);
keystone.set('routes', require('./routes'));
keystone.set('nav', config.nav);

keystone.start({
	onMount () { console.log('Application Mounted'); },
	onStart () { console.log('Application Started'); },
});
github keystonejs / keystone-test-project / advanced.js View on Github external
require('dotenv').config();

var keystone = require('keystone');
var config = require('./config');

/**
 * This is an example of how to use the advanced API to start Keystone,
 * allowing you to customise how app.listen is called
 */

keystone.init(config.options);
keystone.import('models');
keystone.set('locals', config.locals);
keystone.set('routes', require('./routes'));
keystone.set('nav', config.nav);

keystone.initExpressApp();
keystone.openDatabaseConnection(function () {
	var server = keystone.app.listen(process.env.PORT || 3002, function () {
		console.log('-------------------------------');
		console.log('Keystone server ready on port %d', server.address().port);
		console.log('-------------------------------');
	});
});
github keystonejs / keystone-test-project / express.js View on Github external
var compression = require('compression');
var express = require('express');
var keystone = require('keystone');
var morgan = require('morgan');

/**
 * This is an example of creating a custom express app, binding the Admin UI
 * router to it, and using Keystone to intialise the database connection
 */

var config = require('./config');

var app = new express();

keystone.init(config.options);
keystone.import('models');
keystone.set('locals', config.locals);
keystone.set('routes', require('./routes'));
keystone.set('nav', config.nav);

keystone.initDatabaseConfig();
keystone.initExpressSession();

app.use(compression());
app.use('/keystone', keystone.Admin.Server.createStaticRouter(keystone));
app.use(express.static('public'));

app.use(keystone.get('session options').cookieParser);
app.use(keystone.expressSession);
app.use(keystone.session.persist);
app.use(require('connect-flash')());
github justinhelmer / universal-javascript-vue / server / index.js View on Github external
const keystone = require('keystone');
require('./keystone/models');

keystone.init(require('../config/keystone.config'));
keystone.set('routes', require('./routes'));

keystone.start();