A sample REST-API built on Express, TypeScript, and Mongoose
- Node.js 14 or later
- NPM 6.2 or later
- MongoDB 4.3 or later
To run this project, you will need to add the following environment variables to your .env file
PORT
BASE_URL
Clone the project
git clone https://github.com/samanbaboli/sample-typescript-express-mongoose-rest-api.git
Go to the project directory
cd sample-typescript-express-mongoose-rest-api
Install dependencies
npm install
or using yarn
yarn
Start the server
npm run start
To deploy this project run
npm run deploy:prod
or in development
npm run deploy:dev
To run tests, run the following command
npm run test
There are three collections: Profiles
, Simulators
, and Favorites
Method | Route | Description |
---|---|---|
POST |
/api[collectionName] |
Create and item |
GET |
/api[collectionName] |
Get all items of collection |
GET |
/api[collectionName]/:id |
Get an item of collection |
PUT |
/api[collectionName]/:id |
Update an item of collection |
DELETE |
/api[collectionName]/:id |
Delete an item of collection |
For more information on APIs, go to /api-docs and check out all documentation generated by Swagger after running the project