- Install Node version >= 8
- Install Typescript on your system
npm install -g typescript
- Install Mongodb version >= 3.4
In the root directory of this code, use the following commands:
npm install
- it will install your project dependencies
npm run ts
- whenever you change in your server side typescript code it will watch and compile it
npm run start
- it will create build and run server from created build directory
npm run server
- run server from build directory
Note: You need to open port 4000 from the server configurations to make it avaiable for demo-dev server
. if your want to change your server port you can set it through env
variable but you need to open the same port from your server config too:
Default dev ports:
- '4000'
with the following lines:
Default production port:
- '4001`
Steps to set Custom NODE_ENV (development/production
):
Set environment variable NODE_ENV
for MongoDB custom path
Cammand: export NODE_ENV=<NODE-ENV>
(Set Node Environment)
To check/verify your environment variable NODE_ENV
value, use command: echo ${NODE_ENV}
Steps to set Custom mongodb connection string:
Set environment variable MONGO_URI
for MongoDB custom path
Cammand: export MONGO_URI=<MONGO-URI>
(Connection string to connect with db)
To check/verify your environment variable MONGO_URI
value, use command: echo ${MONGO_URI}
This is all we need to deploy this demo node-with-typescript-express
application.
If anyone wants any further instruction can contact me through email.
Thank you