RESTful API with Node.js + Express + Typescript + Mongoose
- Install
Node.js
andnpm
- Install
MongoDB
and setup a local database (the default ismongodb://localhost:27017/test
). For Mac OS, usebrew services start mongodb-community@4.4
- Change the local env variable in
.env
file to local/cloud database. Copy.env.example
to your own.env
. In local,MONGODB_URI
ismongodb://localhost:27017/test
. In Heroku,MONGODB_URI
has been set to a Mongo Atlas Database.
To test and debug, please install a MongoDB GUI (e.g. Robo 3T) and Postman.
npm install
will download all relevant node modules.
npm run dev
will run the program and reload automatically if code changes are applied.
Use the main
branch to deploy: git push heroku main
, deploy to Heroku.