Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zerohertz/crud
🦀 CRUD operations based on various languages 🦀
https://github.com/zerohertz/crud
actix-web crud expressjs fastapi flask gin go java javascript nestjs nodejs python rust spring spring-boot
Last synced: 18 days ago
JSON representation
🦀 CRUD operations based on various languages 🦀
- Host: GitHub
- URL: https://github.com/zerohertz/crud
- Owner: Zerohertz
- License: mit
- Created: 2024-07-29T23:16:52.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-01T13:56:12.000Z (5 months ago)
- Last Synced: 2024-12-06T12:07:03.595Z (18 days ago)
- Topics: actix-web, crud, expressjs, fastapi, flask, gin, go, java, javascript, nestjs, nodejs, python, rust, spring, spring-boot
- Language: Python
- Homepage:
- Size: 209 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🦀 CRUD 🦀
```sh
$ kubectl create ns crud
namespace/crud created
$ kubectl -n crud apply -f k8s
configmap/postgres-config created
secret/postgres-secret created
deployment.apps/postgres created
service/postgres created
deployment.apps/backend created
$ kubectl -n crud exec -it deploy/backend -- zsh
```API Specification
| Function | Endpoint | Method | Description | Request Headers | Request Body | Response |
| --------------------- | ------------- | -------- | ------------------------------------------------ | -------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Create User | `/users` | `POST` | Creates a new user. | `Content-Type: application/json` | `json { "username": "john_doe", "email": "[email protected]", "password": "securepassword123" }` | Status: 201 Created
Body: `json { "id": "1", "username": "john_doe", "email": "[email protected]", "created_at": "2024-07-30T12:34:56Z" }` |
| Get All Users | `/users` | `GET` | Retrieves all users. | - | - | Status: 200 OK
Body: `json [ { "id": "1", "username": "john_doe", "email": "[email protected]", "created_at": "2024-07-30T12:34:56Z" }, { "id": "2", "username": "jane_doe", "email": "[email protected]", "created_at": "2024-07-30T12:40:00Z" } ]` |
| Get User by ID | `/users/{id}` | `GET` | Retrieves a specific user by ID. | - | - | Status: 200 OK
Body: `json { "id": "1", "username": "john_doe", "email": "[email protected]", "created_at": "2024-07-30T12:34:56Z" }` |
| Update User | `/users/{id}` | `PUT` | Updates a specific user's information. | `Content-Type: application/json` | `json { "username": "john_doe_updated", "email": "[email protected]" }` | Status: 200 OK
Body: `json { "id": "1", "username": "john_doe_updated", "email": "[email protected]", "updated_at": "2024-07-30T13:00:00Z" }` |
| Partially Update User | `/users/{id}` | `PATCH` | Partially updates a specific user's information. | `Content-Type: application/json` | `json { "email": "[email protected]" }` | Status: 200 OK
Body: `json { "id": "1", "username": "john_doe", "email": "[email protected]", "updated_at": "2024-07-30T13:30:00Z" }` |
| Delete User | `/users/{id}` | `DELETE` | Deletes a specific user. | - | - | Status: 204
No Content |Database (PostgreSQL) Table Schema
| Field | Data Type | Description | Constraints |
| ---------- | ------------ | ------------------ | ----------------------------------- |
| id | INT | User's unique ID | PRIMARY KEY, AUTO_INCREMENT |
| username | VARCHAR(50) | User's username | NOT NULL, UNIQUE |
| email | VARCHAR(100) | User's email | NOT NULL, UNIQUE |
| password | VARCHAR(255) | User's password | NOT NULL |
| created_at | DATETIME | Creation timestamp | NOT NULL, DEFAULT CURRENT_TIMESTAMP |
| updated_at | DATETIME | Update timestamp | NULL, ON UPDATE CURRENT_TIMESTAMP |
DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}