Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('html:serve', function (cb) {
function alwaysServeIndex(req, res, next) {
// Allow the development server to respond to URLs defined in the front end application.
// Assume that any URL without a file extension can be handled by the client side code
// and serve index.html (instead of 404).
if(!(path.extname(req.url))) {
req.url = "/";
}
next();
}
var server = new http_server.HttpServer({
root: 'app/static',
before: [connect_logger(), alwaysServeIndex]
});
server.listen(8000, function () {
util.log('HTTP server started on port 8000');
cb();
});
});
require('../../../src/config/environment');
require('../../../src/app/polyfills/node-fetch');
const HttpServer = require('http-server').HttpServer;
let openServer = new HttpServer({ root: 'compiled'});
const startLocalServers = (done) => {
openServer.listen(process.env.PORT, 'localhost', () => {
console.log(`Server running on port ${process.env.PORT}`);
done()
});
};
const stopLocalServers = (done) => {
console.log('Closing server...');
openServer.close(done);
};
module.exports = {
start: startLocalServers,
stop: stopLocalServers
async run() {
this._server = new HttpServer({
root: this._root,
gzip: true,
});
return await this._server;
}