Created
May 4, 2020 01:44
-
-
Save intelguasoft/f4bf26dceac9def9373b94046c93df06 to your computer and use it in GitHub Desktop.
What is the right way of production deployment of nestjs application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What is the right way of production deployment of nestjs application | |
Own server | |
1) Checkout your project's repository on your server and run npm install. | |
2) Run npm run build which compiles your project to javascript: | |
rimraf dist && tsc -p tsconfig.build.json | |
3) Start your application with: | |
node dist/main.js | |
Serverless | |
zeit now | |
See this answer. | |
Heroku | |
1) Add the file Procfile to your project's root directory: | |
web: npm run start:prod | |
2) Add this line to your package.json's scripts: | |
"heroku-postbuild": "echo Skip builds on Heroku" | |
3) Set the port in your main.ts (or in your ConfigService) | |
await app.listen(process.env.PORT || 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment