boilerplate-nutella
boilerplate-nutella copied to clipboard
Change the way of setting the PORT on server
Based on that issue https://github.com/jaredpalmer/razzle/issues/356 I found a way to change the port
by using the process.env
.
const getEnv = c => process.env[c];
const PORT = getEnv('PORT');
export default Loadable.preloadAll()
.then(() => express()
.use((req, res) => server.handle(req, res))
.listen(PORT, (err) => {
if (err) {
console.error(err);
return;
}
console.log(`🤰 Running at: http://localhost:${PORT}/.`);
})
);