Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skizzy-create/expressbhospital
π Welcome to Bhakti Hospital! This unique health center, powered by JavaScript and Express.js, is where physical and spiritual health meet. With Zod for data validation, we ensure a smooth user experience. Dive in and explore a new dimension of health management! π₯
https://github.com/skizzy-create/expressbhospital
express-js javascript jwt-authentication mongoose zod
Last synced: about 1 month ago
JSON representation
π Welcome to Bhakti Hospital! This unique health center, powered by JavaScript and Express.js, is where physical and spiritual health meet. With Zod for data validation, we ensure a smooth user experience. Dive in and explore a new dimension of health management! π₯
- Host: GitHub
- URL: https://github.com/skizzy-create/expressbhospital
- Owner: Skizzy-create
- License: mit
- Created: 2023-12-30T08:14:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-15T18:45:43.000Z (7 months ago)
- Last Synced: 2024-11-06T13:25:57.410Z (3 months ago)
- Topics: express-js, javascript, jwt-authentication, mongoose, zod
- Language: JavaScript
- Homepage: https://expressbhospital.onrender.com/
- Size: 412 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π₯ BHospital Projectπ
## π End of Project
π Important Message
β οΈ **End of Project**: As of the last commit, this project has reached a significant milestone, marking the completion of major updates and transitions. The decision has been made to conclude major enhancements and focus on maintaining the project in its current state.
π¨ **Project Evolution**: The development journey has seen a transition from an in-memory database to MongoDB, symbolizing a pivotal learning phase. While this is the end of major updates, the project will continue to evolve through minor enhancements, carrying forward the lessons learned during this crucial development period.
![MongoDB](https://img.shields.io/badge/MongoDB-v4.4.5-green)
![Zod](https://img.shields.io/badge/Zod-v3.7.9-blue)
![JavaScript](https://img.shields.io/badge/JavaScript-ES6-yellow)
![Express.js](https://img.shields.io/badge/Express.js-v4.17.1-lightgrey)
[![GitHub license](https://img.shields.io/github/license/Skizzy-create/expressBHospital.svg)](https://github.com/Skizzy-create/expressBHospital/blob/main/LICENSE)## π Live Project
π This is my very first backend project! It's now live and you can check it out here: [Bhakti Hospital](https://expressbhospital.onrender.com). Your feedback and support are greatly appreciated! π
## π Project Overview
Welcome to the **Bhakti Hospital** - a one-of-a-kind, spiritually-infused, digitally-powered health center! π₯
This project is a testament to the power of JavaScript, showcasing its versatility in creating a unique health management system. It's not just about physical health but also about spiritual health (bhakti) - because we believe in holistic healing! π
Built with **Express.js**, our project provides a robust set of routes to manage users and their health data. From adding new users to updating organ health, our routes have got you covered. And guess what? We've even got a route that calculates a user's maximum health based on a fun mix of physical and spiritual factors! πͺπ§ββοΈ
Data validation is a breeze with **Zod**. We've defined schemas for every piece of data we handle, ensuring that everything is in the right format and keeping those pesky bugs at bay. ππ«
Our middleware functions are the unsung heroes, quietly validating users and organs, counting requests, and even selecting operations. They're like the backstage crew that keeps the show running smoothly. π
## π Project Structure
```plaintext
expressBHospital
β
βββ Backend
β βββ auth
β β βββ auth.js
β βββ data
β β βββ data.js
β β βββ userData.js
β βββ routes
β β βββ userRoutes.js
β βββ utility
β β βββ constants.js
β β βββ middlewares.js
β β βββ middlewaresDB.js
β β βββ schemas.js
β βββ server.js
β
βββ Frontend
βββ index.html
βββ styles.css
βββ scripts.js
```## π οΈ Installation
1. Clone the repository to your local machine using:
```sh
git clone https://github.com/Skizzy-create/expressBHospital.git
```
2. Navigate to the project directory:
```sh
cd expressBHospital
```
3. Install the required dependencies with:
```sh
npm install
```## π Usage
1. Start the server using:
```sh
nodemon server.js
```
2. The server will start running at `https://localhost:3000`.## π¦ Routes and Functionalities
### 1. Welcome Route
- **Route:** `GET /`
- **Description:** Welcome route that sends a welcome message.### 2. Get User Data
- **Route:** `GET /getUser`
- **Description:** Retrieves user data based on the provided `id` query parameter.### 3. Health Report
- **Route:** `GET /healthReport`
- **Description:** Generates a health report for a user based on the provided `id` query parameter. The health report includes the health points and the percentage of fitness.### 4. Update Organ Health
- **Route:** `PUT /updateOrgan`
- **Description:** Updates the health status of an organ for a user. Requires `id`, `organ`, and `ishealthy` in the request body.### 5. Delete Unhealthy Organs
- **Route:** `DELETE /deleteOrgan`
- **Description:** Removes all unhealthy organs for a user based on the provided `id` query parameter.### 6. Add Organ
- **Route:** `POST /addOrgan`
- **Description:** Adds a new organ (heart or kidney) to a user. Requires `id`, `organ`, and `ishealthy` in the request body.## π¦ Authentication Routes (auth.js)
### 1. Sign In
- **Route:** `POST /auth/signin`
- **Description:** Allows users to sign in. Validates user information, creates a JWT token, and saves the user to the MongoDB database.### 2. Get Users (Authenticated)
- **Route:** `GET /auth/users`
- **Middleware:** `userValidDB`
- **Description:** Retrieves user information for authenticated users. Uses JWT token for authentication.## π€ Contributing
Contributions are welcome. Please fork the repository and create a pull request with your changes.
## π License
This project is licensed under the MIT License.
---
Feel free to review and let me know if any additional modifications are needed!