Giter Club home page Giter Club logo

typescript-express-mongo-crud's Introduction

TypeScript Express + MongoDB crud API

1. Usage

 

Installing packages:

npm i

 

Running Application

 

Build the project in javascript:

npm run build

Start the project:

npm run start

Development with typescript

npm run dev

Run application with docker

docker-compose up

 

2. API Documentation

 

Use Postman or Insomnia for testing the API:

We are working with User model here, following is the model schema

 {
   "name": "Tim Book",
   "age": 24,
   "designation": "Football Player",
  }

 

2.1 Routes:

 

GET

This route will give you all the users in database

localhost:3000/api/users/all

GET ONE

This route will give you the user with the provided ID

localhost:3000/api/users/find/:id

POST

Creating new user with the given Request body in JSON

localhost:3000/api/users/new

Eg. Request body

 {
   "name": "Tim Book",
   "age": 24,
   "designation": "Football Player",
 }

DELETE

This route will delete the user with the provided ID

localhost:3000/api/users/delete/:id

UPDATE

This route will update the user with the provided ID and given Request body in JSON

localhost:3000/api/users/update/:id

Notes

Fixing npm run build errors

sudo rm -rf node_modules/ package-lock.json

Build project again

npm run build

Change ownership of data folder

sudo chown -R $USER data

typescript-express-mongo-crud's People

Contributors

pratham82 avatar prathameshedulab avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.