Set env to node_env for the server

This commit is contained in:
Nicolai Ort 2020-11-27 18:46:04 +01:00
parent 27462b0615
commit f2efc4e37b
2 changed files with 10 additions and 8 deletions

View File

@ -4,4 +4,5 @@ DB_HOST=bla
DB_PORT=bla
DB_USER=bla
DB_PASSWORD=bla
DB_NAME=bla
DB_NAME=bla
NODE_ENV=production

View File

@ -8,15 +8,16 @@ dotenvSafe.config();
const PORT = process.env.APP_PORT || 4010;
const app = createExpressServer({
controllers: [__dirname + "/controllers/*.ts"],
controllers: [__dirname + "/controllers/*.ts"],
development: process.env.NODE_ENV === "production",
});
async function main() {
await loaders(app);
app.listen(PORT, () => {
consola.success(
`⚡️[server]: Server is running at http://localhost:${PORT}`
);
});
await loaders(app);
app.listen(PORT, () => {
consola.success(
`⚡️[server]: Server is running at http://localhost:${PORT}`
);
});
}
main();