Giter Club home page Giter Club logo

community-health-backend's Introduction

Community Health Full Stack README

MyAPI is a simple REST API designed for managing customer data. This document serves as a guide to make HTTP requests to our API.

Project structure

Front-end portion has been compressed into the build module. Thus, in order to run the application, simply run npm start. The front-end will be rendered and the back-end will be connected to the application.

Base URL

The base URL for all endpoints is:

http://localhost:3001

Endpoints Below are the available endpoints:

GET / GET /api/persons/:id POST /api/persons DELETE /api/persons/:id GET /api/persons GET /info

GET /

This is the home route and it will return an HTML response.

GET /api/persons/:id

This endpoint retrieves a person with a given id.

Parameters:

id - This is the id of the person.

Example request:

curl http://localhost:3001/api/persons/1

POST /api/persons

This endpoint creates a new person.

Body Parameters:

name - The name of the person. important - A boolean indicating the importance status of the person. (Optional) weight - The weight of the person. age - The age of the person. Example request:

curl -X POST -H "Content-Type: application/json" -d '{"name": "John Doe", "important": true, "weight": 70, "age": 30}' http://localhost:3001/api/persons

DELETE /api/persons/:id

This endpoint deletes a person with a given id.

Parameters:

id - This is the id of the person.

Example request:

curl -X DELETE http://localhost:3001/api/persons/1

GET /api/persons

This endpoint retrieves all persons.

Example request:

curl http://localhost:3001/api/persons

GET /info

This endpoint retrieves the total number of persons and current server time.

Example request:

curl http://localhost:3001/info Errors The API will return the following error types when requests fail:

400: Bad Request – There is missing or invalid information in your request. 404: Not Found – The requested resource could not be found. 500: Internal Server Error – We had a problem with our server. Please try again later. Setup To run the server locally:

Clone the repository Install the dependencies with npm install Start the server with npm start

community-health-backend's People

Contributors

hyunggilwoo 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.