Giter VIP home page Giter VIP logo

node-ts-mongoose's Introduction

node-ts-mongoose

APIs in Node.js with typescript language and mongoose ODM

Steps to start and configure server

  1. Clone/Fork the repo in your workspace
  2. Install the dependancies using npm install
  3. Set up .env file at a root level
  4. Run your mongodb server and change configuration at src/config/mongodb.js if applicable
  5. Run linting and prettier script using npm run lint (optional)
  6. Run command npm start to start the server locally
  7. Use npm run docker:build & npm run docker:run to build and run on docker

API

  1. Load Movies from external URL curl --location --request POST 'http://localhost:3000/v1/api/movies/load/all.json'

  2. Get Movies by release year curl --location --request GET 'http://localhost:3000/v1/api/movies.json?releaseYear=2011&offset=1&limit=5'

  3. Get Movie by id curl --location --request GET 'http://localhost:3000/v1/api/movies/5fde333090a848649e144102.json'

  4. Update Movie by id curl --location --request PUT 'http://localhost:3000/v1/api/movies/5fde333090a848649e144102.json'
    --header 'Content-Type: application/json'
    --data-raw '{ "actor2": "SRK" }'

  5. Delete Movie by id curl --location --request DELETE 'http://localhost:3000/v1/api/movies/5fde333090a848649e144102.json'
    --data-raw ''

  6. Create Movie by id curl --location --request POST 'http://localhost:3000/v1/api/movies.json'
    --header 'Content-Type: application/json'
    --data-raw '{ "title": "180", "releaseYear": "2011", "locations": "Polk & Larkin Streets", "productionCompany": "SPI Cinemas", "director": "jayendra", "writer": "Umarji Anuradha, Jayendra, Aarthi Sriram, & Suba", "actor1": "Siddarth", "actor2": "Nithya Menon", "actor3": "Priya Anand", "createdAt": "2020-12-19T17:06:56.905Z", "updatedAt": "2020-12-19T17:06:56.905Z" }'

Note: All movies are fetched from external URL and then saved in the DB. If external URL is not working, then please use below curl. These API will load the data from seeder and then insert it in DB

curl --location --request POST 'http://localhost:3000/v1/api/movies/seeder/load.json'
--data-raw ''

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.