Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* object accessible through `req.body`
*
*/
var bodyParser = require('body-parser');
// attempt to build the providers/passport config
var config = {};
try {
config = require('../providers.json');
} catch (err) {
console.trace(err);
process.exit(1); // fatal
}
// Set up the /favicon.ico
app.use(loopback.favicon());
// request pre-processing middleware
app.use(loopback.compress());
// -- Add your pre-processing middleware here --
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Credentials", true);
next();
});
// boot scripts mount components like REST API
boot(app, __dirname);
// to support JSON-encoded bodies
app.use(bodyParser.json());
// Passport configurators..
var loopbackPassport = require('loopback-component-passport');
var PassportConfigurator = loopbackPassport.PassportConfigurator;
var passportConfigurator = new PassportConfigurator(app);
// attempt to build the providers/passport config
var config = {};
try {
config = require('../providers.json');
} catch (err) {
console.trace(err);
process.exit(1); // fatal
}
// Set up the /favicon.ico
app.use(loopback.favicon());
// request pre-processing middleware
app.use(loopback.compress());
// -- Add your pre-processing middleware here --
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
// boot scripts mount components like REST API
boot(app, __dirname);
app.use(loopback.cookieParser(app.get('cookieSecret')));
app.use(loopback.session({
secret: app.get('cookieSecret'),
saveUninitialized: true,
resave: true
*/
boot(app, __dirname);
// file persistence
require('./connector');
app.emit('ready');
/*
* 2. Configure request preprocessing
*
* LoopBack support all express-compatible middleware.
*/
app.use(loopback.favicon());
app.use(cookieParser(app.get('cookieSecret')));
app.use(methodOverride());
/*
* EXTENSION POINT
* Add your custom request-preprocessing middleware here.
* Example:
* app.use(loopback.limit('5.5mb'))
*/
/*
* 3. Setup request handlers.
*/
// LoopBack REST interface
app.use(app.get('restApiRoot'), loopback.rest());
var loopback = require('loopback');
var boot = require('loopback-boot');
var app = module.exports = loopback();
var middleware = require('./middleware/index');
var oauth2 = require('loopback-component-oauth2');
// Set up the /favicon.ico
app.middleware('initial', loopback.favicon());
// request pre-processing middleware
app.middleware('initial', loopback.compress());
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname);
var options = {
dataSource: app.dataSources.db, // Data source for oAuth2 metadata persistence
loginPage: '/login', // The login page url
loginPath: '/login', // The login form processing url
useAccessTokenModel: true
var loopback = require('loopback');
var boot = require('loopback-boot');
var app = module.exports = loopback();
// Set up the /favicon.ico
app.use(loopback.favicon());
// request pre-processing middleware
app.use(loopback.compress());
// -- Add your pre-processing middleware here --
// boot scripts mount components like REST API
// Run the boot process asynchronously
boot(app, __dirname, function(err) {
// -- Mount static files here--
// All static middleware should be registered at the end, as all requests
// passing the static middleware are hitting the file system
// Example:
// var path = require('path');
// app.use(loopback.static(path.resolve(__dirname, '../client')));
/*
* 1. Configure LoopBack models and datasources
*
* Read more at http://apidocs.strongloop.com/loopback#appbootoptions
*/
app.boot(__dirname);
/*
* 2. Configure request preprocessing
*
* LoopBack support all express-compatible middleware.
*/
app.use(loopback.favicon());
app.use(loopback.logger(app.get("env") === "development" ? "dev" : "default"));
app.use(loopback.cookieParser(app.get("cookieSecret")));
app.use(loopback.token({model: app.models.accessToken}));
app.use(loopback.json());
app.use(loopback.urlencoded());
app.use(loopback.methodOverride());
app.use(loopback.static(path.join(__dirname, "public")));
/*
* EXTENSION POINT
* Add your custom request-preprocessing middleware here.
* Example:
* app.use(loopback.limit('5.5mb'))
*/
/*
/*
* 1. Configure LoopBack models and datasources
*
* Read more at http://apidocs.strongloop.com/loopback#appbootoptions
*/
app.boot(__dirname);
/*
* 2. Configure request preprocessing
*
* LoopBack support all express-compatible middleware.
*/
app.use(loopback.favicon());
app.use(loopback.logger(app.get('env') === 'development' ? 'dev' : 'default'));
app.use(loopback.cookieParser(app.get('cookieSecret')));
app.use(loopback.token({model: app.models.accessToken}));
app.use(loopback.bodyParser());
app.use(loopback.methodOverride());
/*
* EXTENSION POINT
* Add your custom request-preprocessing middleware here.
* Example:
* app.use(loopback.limit('5.5mb'))
*/
/*
* 3. Setup request handlers.
*/
/*
* 1. Configure LoopBack models and datasources
*
* Read more at http://apidocs.strongloop.com/loopback#appbootoptions
*/
app.boot(__dirname);
/*
* 2. Configure request preprocessing
*
* LoopBack support all express-compatible middleware.
*/
app.use(loopback.favicon());
app.use(loopback.logger(app.get('env') === 'development' ? 'dev' : 'default'));
app.use(loopback.cookieParser(app.get('cookieSecret')));
app.use(loopback.token({model: app.models.accessToken}));
app.use(loopback.bodyParser());
app.use(loopback.methodOverride());
/*
* EXTENSION POINT
* Add your custom request-preprocessing middleware here.
* Example:
* app.use(loopback.limit('5.5mb'))
*/
/*
* 3. Setup request handlers.
*/
/*
* 1. Configure LoopBack models and datasources
*
* Read more at http://apidocs.strongloop.com/loopback#appbootoptions
*/
app.boot(__dirname);
/*
* 2. Configure request preprocessing
*
* LoopBack support all express-compatible middleware.
*/
app.use(loopback.favicon());
app.use(loopback.logger(app.get('env') === 'development' ? 'dev' : 'default'));
app.use(loopback.cookieParser(app.get('cookieSecret')));
app.use(loopback.token({model: app.models.accessToken}));
app.use(loopback.bodyParser());
app.use(loopback.methodOverride());
/*
* EXTENSION POINT
* Add your custom request-preprocessing middleware here.
* Example:
* app.use(loopback.limit('5.5mb'))
*/
/*
* 3. Setup request handlers.
*/
/*
* 1. Configure LoopBack models and datasources
*
* Read more at http://apidocs.strongloop.com/loopback#appbootoptions
*/
app.boot(__dirname);
/*
* 2. Configure request preprocessing
*
* LoopBack support all express-compatible middleware.
*/
app.use(loopback.favicon());
app.use(loopback.logger(app.get('env') === 'development' ? 'dev' : 'default'));
app.use(loopback.cookieParser(app.get('cookieSecret')));
app.use(loopback.token({model: app.models.accessToken}));
app.use(loopback.bodyParser());
app.use(loopback.methodOverride());
/*
* EXTENSION POINT
* Add your custom request-preprocessing middleware here.
* Example:
* app.use(loopback.limit('5.5mb'))
*/
/*
* 3. Setup request handlers.
*/