https://github.com/mario-so/crudrs_template
Containerized Rust + PostgreSQL API
https://github.com/mario-so/crudrs_template
Last synced: 2 months ago
JSON representation
Containerized Rust + PostgreSQL API
- Host: GitHub
- URL: https://github.com/mario-so/crudrs_template
- Owner: Mario-SO
- Created: 2024-06-23T11:04:51.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-23T11:59:15.000Z (11 months ago)
- Last Synced: 2025-02-06T12:19:44.729Z (4 months ago)
- Language: Rust
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🚀 crudrs_template: A Simple CRUD API with PostgreSQL made in Rust 🦀
## 📋 Table of Contents
- [Features](#-features)
- [Getting Started](#-getting-started)
- [Running the Application](#-running-the-application)
- [API Endpoints](#-api-endpoints)
- [Contributing](#-contributing)
- [License](#-license)## ✨ Features
- 📦 Containerized with Docker
- 🗄️ Uses PostgreSQL for data storage
- 🔄 Basic CRUD operations
- 🦀 Built with Rust for speed and safety## 🏁 Getting Started
### Prerequisites
Make sure you have the following installed:
- 🐋 [Docker](https://www.docker.com/)
- 🧳 [Docker Compose](https://docs.docker.com/compose/)
- 💻 [Rust](https://www.rust-lang.org/)### Installation
Clone the repository:
```bash
git clone https://github.com/Mario-SO/crudrs_template.git
cd crudrs_template
```## ▶️ Running the Application
### Using Docker Compose
Simply run the following command to start the application:
```bash
docker-compose up --build
```This will build and start two containers:
- 🦀 `rustapp`: Your Rust application.
- 🗃️ `db`: A PostgreSQL database.### Accessing the API
Once the containers are up, your API will be accessible at:
```
http://localhost:8080
```## 🛠️ API Endpoints
### Create a User
```http
POST /users
```
**Request Body:**
```json
{
"name": "John Doe",
"email": "[email protected]"
}
```### Get All Users
```http
GET /users
```### Get a User by ID
```http
GET /users/{id}
```### Update a User
```http
PUT /users/{id}
```
**Request Body:**
```json
{
"name": "John Doe",
"email": "[email protected]"
}
```### Delete a User
```http
DELETE /users/{id}
```---
Happy coding! 🎉✨