I am trying to deploy a Nestjs API (with Auth0 authentication). When I run it in VS Code with npm run start:watch server
, everything's fine.
Now the question is: what should I do to deploy it on a webserver? Should I only copy the dist folder (after runnin tsc
)? what about node_modules? Should I leave the port to 3000?
As a side note I am trying to deploy it on Azure but I guess the questions holds for any platform.
Many thanks!
1 — Run eb create to start the wizard. 2 — Enter an environment name. 3 — Select an 'Application' load balancer. 5 — Press 'enter' to create a 'Elastic Beanstalk service role'.
Modify your package.json file, and add a postinstall
script, this script should be tsc
or tsc --sourceMap false
if you would like to avoid sourceMaps from being generated.
That would make azure to run tsc after installing all npm packages, remember to change start
script also, so its value is 'node dist/index.js'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With