Skip to content

Commit b5d620e

Browse files
committed
feat(@schematics/angular): Out of the box support for PM2
Because PM2 is the most popular node process manager, it makes sense to support it out of the box. Fixes angular#31081
1 parent 6b97932 commit b5d620e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/schematics/angular/ssr/files/application-builder/server.ts.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ app.use((req, res, next) => {
4848
});
4949

5050
/**
51-
* Start the server if this module is the main entry point.
51+
* Start the server if this module is the main entry point, or it is ran via PM2.
5252
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
5353
*/
54-
if (isMainModule(import.meta.url)) {
54+
if (isMainModule(import.meta.url) || process.env.pm_id) {
5555
const port = process.env['PORT'] || 4000;
5656
app.listen(port, (error) => {
5757
if (error) {

0 commit comments

Comments
 (0)