Coder Social home page Coder Social logo

hngx-stage-2's Introduction

hngx-stage-2

This is the stage two task for the HNGX program. Wish me well, thanks.

Table of Contents

  1. Objective
  2. Features
  3. Prerequisites
  4. Installation
  5. Usage
  6. API Documentation
  7. UML Diagram

Objective:

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. Host your entire project on GitHub, and provide a well-structured documentation in the repository that outlines request/response formats, setup instructions, and sample API usage.

Features

  • Create a new resource
  • Retrieve/Read existing resources
  • Update existing resources
  • Delete resources

Prerequisites

To run this API locally, you need to have the following installed:

  • Node.js (version 18.13.0)
  • npm (version 8.19.3)
  • Mongoose (version 7.5.0)

Installation

  1. Clone the repository:
git clone https://github.com/Richard-githome/hngx-stage-2.git
  1. Install dependencies:
cd hngx-stage-2
npm install
  1. Set up environment variables:

Create a .env file in the root directory and provide the following variables:

PORT=3000
MONGO_URL=mongodb+srv://username:<password>@cluster0.n1m2cz0.mongodb.net/{name-of-the-database}?retryWrites=true&w=majority
  1. Start the server:
npm start

The API will be available at http://localhost:3000/api.

API Documentation

The following endpoints are available:

  • GET /api : Retrive all persons(array) from the database.
  • GET /api/:user_id : Retrives a person object from the database, either by the serial number or name value.
  • POST /api : Saves a person object to the database.
  • PATCH /api/:user_id : Updates a person object in the database.
  • DELETE /api/:user_id : Deletes a person object from the database.

UML Diagram

UML Diagram

hngx-stage-2's People

Contributors

emeka-richard 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.