GithubHelp home page GithubHelp logo

hng-x-2's Introduction

HNG-x-2

Backend Stage Two Task

๐ŸŽฏ Objective

A simple REST API capable of CRUD {create, read, update, delete}operations on a "person" resource that interfaces with a MongoDB database. It allows you to add, retrieve, update, and delete person records.

API Documentation

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Node.js and npm installed on your machine.
  • MongoDB installed and running locally or access to a MongoDB instance.
  • Git (optional, for cloning the repository).

Usage

  1. clone project repository:
git clone https://github.com/Computewell/HNG-x.git
  1. Navigate to the project directory:

    cd hng-x-2
Install dependencies:

```bash
npm install

Create a .env with the values:

MONGO_URI=<replace-with-mongodb-connection-string>
PORT=5000

Start up server:

npm run dev

UML Diagram

Here is the UML (Unified Modeling Language) diagram representing the structure and relationships of this API's classes and models:

UML Diagram

API Endpoints

Route Description
GET /api/:id Fetch a user from the database
POST /api Create a new user
PUT /api/:id Update a user
DELETE /api/:id Delete a user
  • Create a new person:

    POST /api
    
    Request Body:
    {
      "name": "Ololade Akinloye"
    }
  • Retrieve details of a person:

    GET /api/:id
  • Update details of an existing person:

    PATCH /api/:id
    
    Request Body:
    {
      "name": "Updated Name"
    }
  • Remove a person:

    DELETE /api/:id

Testing

To test the API endpoints, you can use tools like Postman or write automated tests using testing libraries like Mocha and Chai. Ensure that you have the necessary testing environment set up.

hng-x-2's People

Contributors

dchefcoder avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.