Coder Social home page Coder Social logo

kitsunekode / express-hospital-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 324 KB

This is a beginner-friendly project that demonstrates the use of Express.js to build a RESTful API for checking and managing kidney health status. It serves as a learning resource for those who are new to Express.js and want to understand how to create basic health management systems.

License: Other

JavaScript 100.00%

express-hospital-api's Introduction

Express Kidney Hospital API

You can explore more pictures in the Pictures directory.

Author: KitsuneKode

Express Kidney Hospital API

This project is an Express.js API that simulates a kidney hospital. It allows users to perform various operations related to kidney health, such as checking the number of kidneys they have, adding a new kidney, replacing a kidney, and removing a kidney. This problem statement project is part of Week 2 of the 0-100xDev course.

Getting Started

To get started with this project, follow these steps:

  1. Clone the repository to your local machine.
  2. Install the required dependencies by running npm install in the project directory.
  3. Start the server by running node index.js or npm start in the project directory.
  4. The server will start running on http://localhost:4000.

API Endpoints

The following API endpoints are available:

1. GET /

This endpoint allows users to check the number of kidneys they have and their health status.

Query Parameters

  • name (required): The name of the user to check.

2. POST /

This endpoint allows users to add a new kidney.

Request Body

  • addStatus (required): The status of the kidney to add. Valid values are "Healthy" or "Not Healthy".

3. PUT /

This endpoint allows users to replace all "Not Healthy" kidneys with "Healthy" kidneys.

4. DELETE /

This endpoint allows users to remove all "Not Healthy" kidneys.

Data Structure

The data structure used in this project is an array of user objects. Each user object has a name property and a kidneys property, which is an array of kidney objects. Each kidney object has a status property, which represents the health status of the kidney.

Usage Examples

Here are some examples of how to use the API endpoints:

GET /

  • Request: GET /?name=John
  • Response: Welcome to this Hospital page John. Number of Kidneys: 2. Number of Good Kidneys: 1. Number of Bad Kidneys: 1. Status of Kidneys: Not Healthy.

POST /

  • Request: POST /
  • Request Body: { "addStatus": "Healthy" }
  • Response: { "Updated_Stats": "Kidney_Added" }

PUT /

  • Request: PUT /
  • Response: All the Bad kidneys are replaced with good ones.

DELETE /

  • Request: DELETE /
  • Response: The patient's Kidneys are healthy.

Contributing

Contributions to this project are welcome. If you find any issues or have any suggestions for improvement, please open an issue or submit a pull request. For more details, please refer to the contribution.md file.

License

This project is licensed under the MIT License.

Contact

If you have any questions or need further assistance, please feel free to contact the project maintainer at .

Acknowledgments

Thanks to all contributors and their valuable input.

Future Improvements

This is a basic application and there are many potential improvements, such as adding a persistent database, validating input, and handling errors more gracefully.

express-hospital-api's People

Contributors

kitsunekode avatar imgbotapp 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.