Skip to content

Stage Two Task You are to build a simple REST API capable of CRUD operations on a "person" resource, interfacing with any database of your choice. Your API should dynamically handle parameters, such as adding or retrieving a person by name. Accompany the development with UML diagrams to represent your system's design and database structure

License

Notifications You must be signed in to change notification settings

Okafor-Ifeanyi/HNG-Stage-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HNG Stage 2 Backend - Develop REST API Capable of CRUD

Node.js Express MongoDB CRUD API

A simple REST API for CRUD operations on a "person" resource using Node.js, Express, MongoDB, and Mongoose.

Table of Contents

Prerequisites

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.

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/Okafor-Ifeanyi/HNG-Stage-2
  2. Change to the project directory:

    cd your-api-repo
  3. Install dependencies:

    npm install

Environment Variables

  • 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

API Endpoints

  • 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

Testing

Use Postman or your preferred API testing tool to test the CRUD operations. Here's a sample Postman collection you can import: Postman Collection.

Render Live

Documentation

Postman Docs

UML Diagram

Diagrams on dbdiagrams.io

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License.

Copyright (c) 2023 Prog BIO

About

Stage Two Task You are to build a simple REST API capable of CRUD operations on a "person" resource, interfacing with any database of your choice. Your API should dynamically handle parameters, such as adding or retrieving a person by name. Accompany the development with UML diagrams to represent your system's design and database structure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published