Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable */
var loopback = require('loopback');
var log = {};
var Log = loopback.getModel('Log');
var updated1 = Log.create(log);
console.log(updated1);
var file = {};
var File = loopback.getModel('File');
var updated2 = File.create(file);
console.log(updated2);
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'))
*/
/*
* 3. Setup request handlers.
*/
// LoopBack REST interface
app.use(app.get('restApiRoot'), loopback.rest());
// API explorer (if present)
/*
* 4. Setup error handling strategy
*/
/*
* EXTENSION POINT
* Add your custom error reporting middleware here
* Example:
* app.use(function(err, req, resp, next) {
* console.log(req.url, ' failed: ', err.stack);
* next(err);
* });
*/
// The ultimate error handler.
app.use(loopback.errorHandler());
/*
* 5. Add a basic application status route at the root `/`.
*
* (remove this to handle `/` on your own)
*/
app.get('/', loopback.status());
/*
* 6. Enable access control and token based authentication.
*/
var swaggerRemote = app.remotes().exports.swagger;
if (swaggerRemote) {
// Let express routes handle requests that were not handled
// by any of the middleware registered above.
// This way LoopBack REST and API Explorer take precedence over
// express routes.
app.use(app.router);
// The static file server should come after all other routes
// Every request that goes through the static middleware hits
// the file system to check if a file exists.
app.use(loopback.static(path.join(__dirname, 'public')));
// Requests that get this far won't be handled
// by any middleware. Convert them into a 404 error
// that will be handled later down the chain.
app.use(loopback.urlNotFound());
/*
* 4. Setup error handling strategy
*/
/*
* EXTENSION POINT
* Add your custom error reporting middleware here
* Example:
* app.use(function(err, req, resp, next) {
* console.log(req.url, ' failed: ', err.stack);
* next(err);
* });
*/
// The ultimate error handler.
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'))
*/
/*
* 3. Setup request handlers.
*/
// LoopBack REST interface
app.use(app.get('restApiRoot'), loopback.rest());
* console.log(req.url, ' failed: ', err.stack);
* next(err);
* });
*/
// The ultimate error handler.
app.use(loopback.errorHandler());
/*
* 5. Add a basic application status route at the root `/`.
*
* (remove this to handle `/` on your own)
*/
app.get('/', loopback.status());
/*
* 6. Enable access control and token based authentication.
*/
var swaggerRemote = app.remotes().exports.swagger;
if (swaggerRemote) {
swaggerRemote.requireToken = false;
}
app.use(loopback.token({model: app.models.accessToken}));
app.enableAuth();
/*
* 7. Optionally start the server
*
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.
*/
// LoopBack REST interface
app.use(app.get('restApiRoot'), loopback.rest());
// API explorer (if present)
try {
var explorer = require('loopback-explorer')(app);
app.use('/explorer', explorer);
app.once('started', function(baseUrl) {
console.log('Browse your REST API at %s%s', baseUrl, explorer.route);
});
} catch(e){
console.log(
'Run `npm install loopback-explorer` to enable the LoopBack explorer'
);
}
/*
* EXTENSION POINT
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.
*/
// LoopBack REST interface
app.use(app.get('restApiRoot'), loopback.rest());
// API explorer (if present)
try {
var explorer = require('loopback-explorer')(app);
app.use('/explorer', explorer);
app.once('started', function(baseUrl) {
console.log('Browse your REST API at %s%s', baseUrl, explorer.route);
});
} catch(e){
console.log(
'Run `npm install loopback-explorer` to enable the LoopBack explorer'
);
}
/*
* EXTENSION POINT
'use strict';
var loopback = require('loopback');
var boot = require('loopback-boot');
var app = module.exports = loopback();
app.use(loopback.token({
model: app.models.MultiAccessToken
}));
app.start = function() {
// start the web server
return app.listen(function() {
app.emit('started');
var baseUrl = app.get('url').replace(/\/$/, '');
console.log('Web server listening at: %s', baseUrl);
if (app.get('loopback-component-explorer')) {
var explorerPath = app.get('loopback-component-explorer').mountPath;
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
}
});
};
var loopback = require('loopback');
var boot = require('loopback-boot');
var path = require('path');
var app = module.exports = loopback();
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname);
//
app
// static files, for ClientApp
.use( loopback.static(path.resolve(__dirname, '../client')) )
//
.use( '/', function(req, res, next ){
res.sendFile('ServerApp/client/index.html', {root: '../'});
})
//
app.start = function() {
// start the web server
return app.listen(function() {
app.emit('started');
console.log('Web server listening at: %s', app.get('url'));
});
};
// start the server if `$ node server.js`