We have decided to deploy on heroku,since it has some free dynos. Heroku is integrated with GitHub and has “automatic deploys” – that means that every push will automatically deploy to Heroku. That will be an opportunity for AzureDevOps to verify correct deploy ( even if appears different …)
Some points here:
1. Heroku is calling web npm start . So in the root of the project we should have a package.json with a start script that starts our api
“start”: “cd bingo-cards-api && yarn start”,
2. Heroku is stripping dev dependecies. So,if you did not compile the project – and want too use tsc or other dependemcies,you should add on Heroku site the setting NPM_CO NFIG_PRODUCTION false
3. The swagger from nestjs is,somehow,calling the HTTP,not the HTTPS . So the https://bingo-meeting-api.herokuapp.com/api/ does not work,but http://bingo-meeting-api.herokuapp.com/api/ works
4.Because we can call from other sites,the CORS should be enabled .
app.enableCors();
5. Also,we should enable dynamic port for Heroku
const port: string = process.env.PORT || “3000”;
await app.listen(parseInt(port,10));
After this,you can try the API at http://bingo-meeting-api.herokuapp.com/api/
Leave a Reply