-
first branch:
basic_nodejs
This is a Node.js project that provides a simple RESTful API for managing car data. It uses local JSON data and plain Node.js without any external libraries. -
second branch:
express
In the further development of the project, the express framework will be implemented in the project. -
third branch:
mongoDB
as themain
branch The local JSON database has been replaced by a noSQL database, MongoDB Thepost.js
can help you uploadcars.json
to the MongoDB if the program has already been created. Run the following commands:node post.js
To get started with the project, clone the repository and run the following commands:
npm install
npm run dev
This will install the required dependencies and start the server on port 8080.
http://localhost:8080/api/products
/api/products
-> GET -> get all items
/api/products
-> POST - add new item -> validation
/api/products/{id}
-> GET -> get id's item
/api/products/{id}
-> PATCH - edit the item -> validation
/api/products/{id}
-> DELETE - delete the item
/api/products/?queries
/api/products/?name=BMW
/api/products/?fuel_types=gasoline
Check out the opportunities in this URL
api/fuels
/api/products/?type=sedan
Check out the opportunities in this URL
api/types
-min_seats
-max_seats
/api/products/?min_seats=3
/api/products/?max_seats=5
/api/products/?min_seats=3&max_seats=5
-min_price
-max_price
/api/products?min_price=30000
/api/products?max_price=50000
/api/products?min_price=30000&max_price=50000
- min_production_year
- max_production_year
/api/products?min_production_year=2008
/api/products?max_production_year=2010
/api/products?min_production_year=2008&max_production_year=2010