Skip to content

Instantly share code, notes, and snippets.

@mbenedettini
Last active February 28, 2017 22:14
Show Gist options
  • Save mbenedettini/18f5623727ce23544c3e780408bdf3cb to your computer and use it in GitHub Desktop.
Save mbenedettini/18f5623727ce23544c3e780408bdf3cb to your computer and use it in GitHub Desktop.
const loopback = require('loopback');
const boot = require('loopback-boot');
const logger = require('logger');
const app = loopback();
// This module resides in /lib so we should boot project from ../server
boot(app, __dirname + '/../server');
logger.debug('Loopback initialized');
app.stop = function () {
// Disconnect from every data source
Object.keys(app.dataSources).forEach(name => {
let d = app.dataSources[name];
if (typeof d.disconnect === 'function') {
d.disconnect();
}
});
};
module.exports = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment