Back-End application inspired by Product Hunt made with Node.js, Express and MongoDB
The purpose of this application is to practice the concepts of Node.js as seen in the Rocketseat free course.
This project needs a Mongo Database to work, it can be set up easily with Docker
After Docker installation run docker pull mongo to download a Mongo image
Then create a new container, and redirect ports with docker run --name mongodb -p 27017:27017 -d mongo
Now you can start your container when needed with docker start mongodb
Inside the project root directory run npm install or yarn install to install the project dependencies
Finally you can run npm run dev or yarn dev to start de back-end server
You can easily test all the routes with Insomnia
-
GET http://localhost:3001/api/products
- List all products (return products array)
-
GET http://localhost:3001/api/products/:id
- Show a expecific product (return a product)
-
POST http://localhost:3001/api/products
- Store a new product (return the new product)
-
PUT http://localhost:3001/api/products/:id
- Update a product (return the updated product)
-
DELETE http://localhost:3001/api/products/:id
- Delete a product (return an empty message)
- node_modules/ (project dependencies)
- src/ (main application files)
- controllers/ (application controllers)
- models/ (application models)
- routes.js (application routes)
- server.js (initialize the application)