Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zgunz42/backend-repo
https://github.com/zgunz42/backend-repo
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zgunz42/backend-repo
- Owner: zgunz42
- Created: 2024-06-24T05:50:54.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-26T05:30:21.000Z (4 months ago)
- Last Synced: 2024-06-27T06:52:14.872Z (4 months ago)
- Language: TypeScript
- Size: 172 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Backend Repository
This repository contains the backend implementation using Express.js and Firebase for authentication and Firestore database.
## Directory Structure
```
backend-repo/
├── config/
│ └── firebaseConfig.ts
├── controller/
│ └── api.ts
├── core/
│ └── app.ts
├── entities/
│ └── ApiError.ts
├── middleware/
│ └── authMiddleware.ts
├── repository/
│ └── userCollection.ts
├── routes/
│ └── userRoutes.ts
└── package.json
```## Setup
1. **Install Dependencies**
```bash
npm install
```2. **Firebase Configuration**
Set up Firebase by creating a `firebaseConfig.ts` file in the `config` directory with your Firebase project credentials.
3. **Run Locally**
To run the backend server locally:
```bash
npm run dev
```## Endpoints
### `update-user-data`
- **Description:** Updates current user status Firestore data in the USERS collection.
- **Method:** PUT
- **Endpoint:** `/update-user-data`### `fetch-user-data`
- **Description:** Fetches Firestore data in the USERS collection.
- **Method:** GET
- **Endpoint:** `/fetch-user-data`## Middleware
### `authMiddleware`
- **Description:** Middleware to validate the request token.
- **Location:** `middleware/authMiddleware.ts`## Error Handling
Custom error handling with an `ApiError` class for standardized error responses.
## Notes
Login Credential
email: [email protected]
password: 123456