nodigo
Version:
Nodejs Developer Tools set. A Web based Nodejs manager with powerful tools and amazing UI.
23 lines (19 loc) • 707 B
JavaScript
exports.main = function (config) {
//Require the modules, needed
const express = require('express');
const path = require("path");
const morgan = require("morgan");
const app = express();
//Some express configs
app.use('/', express.static(path.join(__dirname, '/static-front-end')));
app.use(morgan('combined'));
//Handle requests
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/static-front-end/index.html'));
});
//Start the server
app.listen(config.port, () => console.log('app listening on port '+ config.port));
app.on('error', (e) => {
console.log("Error occurred: "+e);
})
};