1.0.2 • Published 5 years ago
lazy_express_server v1.0.2
Express Server.
To create lazy express server
$ npm install lazy_express_server
var serverModule = require('lazy_express_server');
var Promise = require('bluebird');
var conf = {
web: {
host: 'localhost',
port: 3007,
views: '/webapp', // Optional
static: '/views', // Optional
root:'' // Declare this from server file using __dirname
}
};
conf.web.root = __dirname;
(function() {
var app = new serverModule(conf); // Pass conf
return new Promise(function () {
app.createServer()
.then(function (result) {
if (result && result.status) {
// get the app from result.app and use it
console.log(" Success");
} else {
console.log(" Failure");
}
})
.catch(function (err) {
throw new Error(err);
});
});
})();