CRUD API integration with Node and MongoDB
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
brew install node
- Clone/Fork the repo in your workspace
- install the dependancies using
npm install
- set up
.env
file at a root level - run your mongodb server and change configuration at config/db.js if applicable
- run command
npm start
to start the server
-
Load all movies from seeder curl --location --request POST 'http://localhost:3000/api/load/all'
-
Get All movies (without filtering and options) curl --location --request GET 'http://localhost:3000/api/movies'
-
Get movie by id curl --location --request GET 'http://localhost:3000/api/movies/5edab5b4a92dc58e819c33a5'
-
Update movie by id curl --location --request PUT 'http://localhost:3000/api/movies/5edab5b4a92dc58e819c33a5'
--header 'Content-Type: application/json'
--data-raw '{ "title": "1000", "release_year": "2011", "locations": "555 Market St.", "production_company": "SPI Cinemas updated", "writer": "Umarji Anuradha, Jayendra, Aarthi Sriram, & Suba", "actor_1": "Siddarth", "actor_3": "Siddarth" }' -
Delete movie by id curl --location --request DELETE 'http://localhost:3000/api/movies/5edab5b4a92dc58e819c33a5'
-
Insert movie curl --location --request POST 'http://localhost:3000/api/movies'
--header 'Content-Type: application/json'
--data-raw '{ "title": "1000", "release_year": "2011", "locations": "555 Market St.", "production_company": "SPI Cinemas updated", "director": "jayendra", "writer": "Umarji Anuradha, Jayendra, Aarthi Sriram, & Suba", "actor_1": "Siddarth", "actor_2": "Nithya Menon", "actor_3": "Siddarth" }' -
Update Movie by Query curl --location --request PUT 'http://localhost:3000/api/movies?actor_1=Siddarth&locations=555%20Market%20St.&release_year=2011'
--header 'Content-Type: application/json'
--data-raw '{ "distributor": "Home Production", "actor_2": "HP" }' -
Get Movie with filtering in query and options curl --location --request GET 'http://localhost:3000/api/movies?title=Always%20Be%20My%20Maybe'
--header 'limit: 50'
--header 'offset: 0'
--header 'sort_by: release_year'
--header 'sort_val: desc'