Skip to content

samanbaboli/sample-typescript-express-mongoose-rest-api

Repository files navigation

A sample REST-API built on Express, TypeScript, and Mongoose

A sample REST-API built on Express, TypeScript, and Mongoose

Requirements

  • Node.js 14 or later
  • NPM 6.2 or later
  • MongoDB 4.3 or later

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

PORT BASE_URL

Run Locally

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

Deployment

To deploy this project run

  npm run deploy:prod

or in development

  npm run deploy:dev

Running Tests

To run tests, run the following command

  npm run test

API Reference

There are three collections: Profiles, Simulators, and Favorites

CRUD

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

Authors

About

A sample rest api built on Express, Typescript, and Mongoose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published