Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy Nestjs App (on Azure)?

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!

like image 810
qbodart Avatar asked Dec 07 '17 11:12

qbodart


People also ask

How do I deploy NestJS app to Elastic Beanstalk?

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'.


1 Answers

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'

like image 135
Jesú Castillo Avatar answered Oct 12 '22 20:10

Jesú Castillo