Create a folder and initialize the node js project.
Next, install TypeScript as a dev dependency:
Once that’s downloaded, create a tsconfig.json file:
Change some configuration for tsconfig.json:
Install Express and its typing as a dev dependency and :
Create an express server :
Install and configure swc (superfast web compiler as an alternative for the swc )
npm install –save-dev @swc/cli @swc/core
Create a config file for swc as .swcrcod
Running and watching the changes install nodemon and ts-node, and create nodemon.json, you can set other files too to watch in the array.
Scripts to run :
Run the app in development:
Prerequisites:
Reference links :
Docker https://www.docker.com/101-tutorial/
Setting Up Docker File To Build The Image :
Specify the above in the file.
Cmd: docker build -t image-name. //build image by using the current directory
Cmd: docker run –name container-name -p 8001:8000 image-name //running a container exposing it to a desired port outside the container.
(Here we are going to use compose so we don’t need to build an image and run the containers with the above command we can specify it in the compose file if there is only one service the image can be directly built and run container by the above commands)
Using Docker Compose
Running multiple containers(node app+postgres)
Docker Compose: https://docs.docker.com/compose/gettingstarted/
It automatically build the images from the docker file when specific if the image exist else uses existing images.
Dockerizing Postgres and node+ts app with docker-compose.
We are always looking out for new collaborations, whether you are a client who is passionate about a project or a talent who is interested in joining our team, our doors are always open.
618, Shekhar Central, Palasia Square, A.B Road, Indore, Madhya Pradesh, 452001
+918109561401
Brain Inventory, SBVS, 8 Roundhay Road, Leeds, UK, LS7 1AB
+18008209286
44 Main Street East Milton, ONCanada L9T 1N3
+4166696505
185 Wasfi Al-Tal Street, Ammon Oasis Complex P.O Box 4724 Amman 11953 Jordan
+960770781000
720 Seneca St Ste 107 Seattle, USA 98101
+1(206)6533419