Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aitthi/rust-api-example
a simple example of rust api
https://github.com/aitthi/rust-api-example
axum openapi rust swagger swagger-ui
Last synced: 3 days ago
JSON representation
a simple example of rust api
- Host: GitHub
- URL: https://github.com/aitthi/rust-api-example
- Owner: Aitthi
- Created: 2023-10-11T16:38:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-06T04:45:26.000Z (8 months ago)
- Last Synced: 2024-03-06T05:38:15.377Z (8 months ago)
- Topics: axum, openapi, rust, swagger, swagger-ui
- Language: Rust
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust-api-example
a simple example of rust api## OpenAPI UI
```
http://localhost:8080/apidoc
```## Folder structure
```
.
├── Cargo.toml # workspace members
├── api
| ├── som_api
│ │ ├── Cargo.toml
│ │ ├── src
│ │ │ ├── lib.rs
│ │ │ ├── routes.rs
│ │ │ ├── api_doc.rs
│ │ │ ├── resource
│ │ │ │ ├── mod.rs
│ │ │ │ └── som_func.rs
├── runtime
│ ├── Cargo.toml
│ ├── src
│ │ └── main.rs
├── package
| ├── som_package
│ │ ├── Cargo.toml
│ │ ├── src
│ │ │ ├── lib.rs
│ │ │ └── som_func.rs
└──
```## Development
To develop the application, you will need to install the following tools:
1. Clone the repository:
```sh
git clone https://github.com/Aitthi/rust-api-example.git
```
2. Change to the project directory:
```sh
cd rust-api-example
```
3. Generate an RSA certificate for JWT:
```sh
openssl genrsa -out ./config/jwt/private.key 4096
```
```sh
openssl rsa -in ./config/jwt/private.key -pubout -outform PEM -out ./config/jwt/public.key
```
4. Run the application:
```sh
cargo run
```
Or, to automatically rebuild and restart:
```sh
cargo watch -q -c -x 'run'