REST API for Managing Persons
This is a simple REST API built with Nodejs, Express and MongoDB for managing persons. It allows you to perform CRUD (Create, Read, Update, Delete) operations on a "person" resource.
Table of Contents
Prerequisites
Before getting started, ensure you have the following installed on your computer:
- Node.js and npm (Node Package Manager). You can use any package manager eg pnpm or yarn
- MongoDB (You can install it locally or use a cloud-based MongoDB service)
Installation
Follow these steps to set up and run the project:
-
Clone the repository to your local machine:
git clone https://github.com/CyberVerse2/hng-stage-2.git
-
Navigate to the project directory
cd api_hng_2
-
Run the following command to install dependencies:
npm install
-
Create a .env file in the project root and configure your MongoDB connection:
DB_URL=mongodb://localhost:27017/hng2 PORT=3000
-
Run the following command to start the server:
node index.js
Your Express server should now be running at http://localhost:8000.
Database Modeling
This UML diagram below represents the structure and relationships of the API's classes and models.
Documentation
Here is the postman documentation for the API .
Testing
The documentation include test to verify the API's functionality.