Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() => {
const server = express();
server.use(createRouter(app, routerOptions));
server.listen(3000, err => {
if (err) {
throw err;
}
// eslint-disable-next-line no-console
console.log('> Ready on http://localhost:3000');
});
})
.catch(ex => {
.then(() => {
const server = express();
server.use(createRouter(app));
server.listen(soya.config.port, err => {
if (err) {
throw err;
}
// eslint-disable-next-line no-console
console.log(`> Ready on http://localhost:${soya.config.port}`);
});
})
.catch(ex => {
.then(() => {
const server = express();
server.use(createRouter(app));
server.listen(3000, err => {
if (err) {
throw err;
}
// eslint-disable-next-line no-console
console.log('> Ready on http://localhost:3000');
});
})
.catch(ex => {
.then(() => {
const server = express();
server.use(createRouter(app, routerOptions));
server.listen(3000, err => {
if (err) {
throw err;
}
// eslint-disable-next-line no-console
console.log('> Ready on http://localhost:3000');
});
})
.catch(ex => {
res.header(field, config.server.headers[field]);
});
next();
});
const includeSoyaLegacy =
process.argv.indexOf("--include-soya-legacy") !== -1;
const soyaMiddleware = includeSoyaLegacy
? require(join(appDir, "build", "server", "index.js")).default
: null;
if (soyaMiddleware !== null) {
server.use(soyaMiddleware);
}
server.use(
createRouter(app, {
basePath: config.basePath,
routes: config.routes,
redirects: config.redirects,
defaultLocale: config.defaultLocale,
siteLocales: config.siteLocales,
compression: config.server.compression,
whoami: config.whoami
})
);
server.listen(config.server.port, config.server.host, err => {
if (err) {
throw err;
}
if (typeof process.send === "function") {
process.send("ready");