This Rest API boiler plate was created using different "often used" technologies for example:
- Node.js
- Express
- Typescript
- Typegoose and Mongoose (ODM "Object Document Mapper")
TODO: Create generic repository pattern and remove last dependencies
- MongoDB
I followed this tutorial in order to understand the functionality and logic of an Express Node Typescript application.
- Routes
- Controllers
- Models
That was intended to follow the MVC model represented in the following image:
image source: developer.mozilla.org
Install dependencies using npm :
npm install
Create .env file in src
with following variables :
MONGO_USER
MONGO_PASSWORD
DB_CONNECTION_STRING
DB_SERVER
PORT
JWT_SECRET
Example :
Mongodb connection URI:
mongodb://<mongodb_password>:<password>@mongodb0.example.com:27017/admin
MONGO_USER=<database_password>
MONGO_PASSWORD=<database_password>
DB_CONNECTION_STRING=mongodb://
DB_SERVER=@mongodb0.example.com:27017/admin
PORT=<desired_port>
JWT=<desired_jwt_secret>
npm run dev
npm run dev:start
npm run build
npm run clean
npm run lint
npm run tsc
npm run dev:typescript