Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pumpum7/rust-blog-app
A rust blog app created for the Jetbrains internship applications
https://github.com/pumpum7/rust-blog-app
Last synced: about 2 months ago
JSON representation
A rust blog app created for the Jetbrains internship applications
- Host: GitHub
- URL: https://github.com/pumpum7/rust-blog-app
- Owner: PumPum7
- Created: 2024-09-10T14:44:02.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-11T16:13:23.000Z (4 months ago)
- Last Synced: 2024-09-12T03:02:32.688Z (4 months ago)
- Language: Rust
- Size: 99.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blogpost App
This is a blogpost application built with Rust using the Axum web framework.
## Technologies Used
- Rust 1.81
- Axum web framework
- SQLite for database
- Docker for containerization## Features
- Create blog posts with text content
- Upload images for blog posts
- Set user avatars via URL
- View all posts in a feed## How to Run
### Prerequisites
- Docker installed on your system
### Steps
1. Clone the repository
2. Build the Docker image:
```
docker build -t blogpost-app .
```3. Run the Docker container:
```
docker run -p 3000:3000 blogpost-app
```4. Access the application in your web browser at `http://localhost:3000/home`
## Project Structure
- `src/main.rs`: Main application code
- `src/handlers.rs`: Request handlers
- `src/state.rs`: Application state and database initialization
- `src/models.rs`: Data models
- `src/errors.rs`: Error handling
- `src/index.html`: HTML template for the home page
- `Dockerfile`: Docker configuration for building and running the app
- `images/`: Directory for storing uploaded images (created at runtime)## API Endpoints
- GET `/`: Redirects to `/home`
- GET `/home`: Displays the home page
- POST `/submit`: Submits a new blog post
- GET `/posts`: Retrieves all blog posts## Notes
- The application uses an SQLite database to store blog posts.
- Uploaded images are stored in the `images/` directory.
- The application runs on port 3000 by default.