Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taeyoonkwon/rust-rocket-sample
Fully working CRUD REST API example using Rust and Rocket.rs
https://github.com/taeyoonkwon/rust-rocket-sample
boilerplate mongodb okapi rest-api rocket rust template
Last synced: 6 days ago
JSON representation
Fully working CRUD REST API example using Rust and Rocket.rs
- Host: GitHub
- URL: https://github.com/taeyoonkwon/rust-rocket-sample
- Owner: TaeyoonKwon
- License: mit
- Created: 2022-02-11T15:26:45.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-15T15:55:26.000Z (6 months ago)
- Last Synced: 2025-01-08T10:06:48.763Z (13 days ago)
- Topics: boilerplate, mongodb, okapi, rest-api, rocket, rust, template
- Language: Rust
- Homepage:
- Size: 52.7 KB
- Stars: 62
- Watchers: 4
- Forks: 19
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# rust-rocket-sample
[![CI](https://github.com/TaeyoonKwon/rust-rocket-sample/actions/workflows/ci.yaml/badge.svg)](https://github.com/TaeyoonKwon/rust-rocket-sample/actions/workflows/ci.yaml)Fully working CRUD REST API example using
- Rust (stable)
- Rocket.rs
- mongodb
- okapi## đ Features
- Establish MongoDB connection using rocket Adhoc fairing.
- Custom error handlings with rocket Responder and okapi OpenApiGenerator.
- CORS fairing and Counter fairing to demonstrate how fairing works.
- Example model Customer to demonstrate how Rust structs interact with MongoDB.
- Request guard using ApiKey.
- REST API endpoints with simple CRUD using Customer model.
- Implement Open API documentation using okapi.
- Test codes to test API endpoints.## đ§ Building and Testing
### debug mode
> cargo run### release mode
> cargo build --release && cargo run --release### unit testing
> cargo test
âšī¸ _You should create your own `.env` file including `MONGO_URI`, `MONGO_DB_NAME`, and `API_KEY` to run it._
## đ License
[MIT](https://github.com/TaeyoonKwon/rust-rocket-sample/blob/main/LICENSE) Copyright (c) 2022 Taeyoon Kwon