Skip to content

Aitthi/rust-api-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:
    git clone https://github.com/Aitthi/rust-api-example.git
  2. Change to the project directory:
    cd rust-api-example
  3. Generate an RSA certificate for JWT:
    openssl genrsa -out ./config/jwt/private.key 4096
    openssl rsa -in ./config/jwt/private.key -pubout -outform PEM -out ./config/jwt/public.key
  4. Run the application:
    cargo run
    Or, to automatically rebuild and restart:
    cargo watch -q -c -x 'run'

Releases

No releases published

Packages

No packages published