Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanerix/rust-api-example
https://github.com/kanerix/rust-api-example
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/kanerix/rust-api-example
- Owner: Kanerix
- License: apache-2.0
- Created: 2023-05-29T19:36:43.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-24T18:28:43.000Z (about 1 year ago)
- Last Synced: 2023-10-25T10:25:54.376Z (about 1 year ago)
- Language: Rust
- Size: 313 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-api-example
This is an example repo that shows how i would implement a REST API using the Rust programming language.
!! To run this project you must have Rust installed on your system !!
### Requirements
#### Generate Public and Private key for JWT.
Run these commands:
1. `openssl genpkey -algorithm ed25519 -out keys/private.pem`
2. `openssl pkey -in keys/private.pem -pubout -out keys/public.pem`### Start the project
- For SQLx to work properly, you also need to have a database.
- Run `docker compose up postgres -d` to start a development database.
- Full out a `.env` file with the `.env.example` variables.
- Migrate your database with `SQLx` (`sqlx migrate dev`).
- Run the command `cargo run`.### Using docker
- Run `docker compose up -d` to start the project running in the background.