added NODE_ENV variable checking to server.ts
This commit is contained in:
1 parent
2d9225d625
commit
e20d4b45b6
1 file changed
+1
-1
+1
-1
@@ -78,7 +78,7 @@ app.use((req, res, next) => {
|
|||||||
* Start the server if this module is the main entry point, or it is ran via PM2.
|
* Start the server if this module is the main entry point, or it is ran via PM2.
|
||||||
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
|
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
|
||||||
*/
|
*/
|
||||||
if (isMainModule(import.meta.url) || process.env['pm_id']) {
|
if (isMainModule(import.meta.url) || process.env['pm_id'] || process.env['NODE_ENV'] === 'production') {
|
||||||
const port = process.env['PORT'] || 4000;
|
const port = process.env['PORT'] || 4000;
|
||||||
app.listen(port, (error) => {
|
app.listen(port, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
Reference in new issue
Block a user