http-api-rs
January 18, 2023 ยท View on GitHub
Template project for creating REST API's in rust
Features
- Actix Web Server
- OpenAPI (SwaggerUI) Documentation
- SeaQL ORM
- Log with env_logger
Project Status
Development
Pre-requisites
Please install the following packages:
cargo install sea-orm-cli
cargo install cargo-watch
Watch for changes
it is recommended that you use cargo-watch:
cargo watch -x 'run'
Environment variables
Please check src/env.rs for a list of environment variables.
Set up database
To create database run:
# make migrate
Dev server
Run:
# make dev
You should be able to access the in the browser http://localhost:9090
Swagger Docs
You should be able to access the in the browser http://localhost:9090/swagger-ui/
Healthcheck
To check the servers health, run:
# make health
you should see successfull response eg
{
"rest_api":"Operational",
"database":"Operational"
}
To troubleshoot any issues. Please see the stdout from the dev server.
Lint
Before making pull requests, you must use cargo clippy to check that your code meets the coding standards. You can run:
# make lint
or to automatically fix style issues run:
# make fix