Bingo meetings–deploying to heroku–part 19

Bingo

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at https://github.com/alexandru360/PresentationBingoCards/ . Those are my blog posts for Bingo : ( scroll below for the post)
NrLink
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
12CLI
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
20Angular
21Deploy Angular to GitHub
22WebAPI and Web
23Documentation
24Documentation of the code
25Conclusions

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/