A simple REST API for CRUD operations on a "person" resource using Node.js, Express, MongoDB, and Mongoose.
Before you begin, ensure you have met the following requirements:
- IDE- Vscode or any suitable.
- Node.js and npm installed.
- MongoDB installed and running.
- Postman or a similar tool for API testing.
-
Clone the repository:
git clone https://github.com/Okafor-Ifeanyi/HNG-Stage-2
-
Change to the project directory:
cd your-api-repo
-
Install dependencies:
npm install
- Create a .env file in the root directory of your project and add the following environment variables:
MONGO_URI= ? your_mongodb_uri_here PORT= ? your_desired_port_here
MONGO_URI=your_mongodb_uri_here
PORT=your_desired_port_here
-
Create a new person:
POST /api/
-
Get details of a person by ID or Name:
GET /api/:info
-
Update details of an existing person by ID:
PATCH /api/:id
-
Remove a person by ID:
DELETE /api/:id
Use Postman or your preferred API testing tool to test the CRUD operations. Here's a sample Postman collection you can import: Postman Collection.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License.
Copyright (c) 2023 Prog BIO