在 Rust 中构建 REST Web 服务的可重复使用模板。使用 Axum HTTP Web 框架和 SeaORM
Reusable template for building REST Web Services in Rust. Uses Axum HTTP web framework and SeaORM ORM and PostgreSQL.
To use this template as your project starting point, click "Use this template" at the top of this page, or click here.
./run
# open swagger panel
xdg-open http://127.0.0.1:8080/swagger-ui/
# manually testing your API routes with curl commands
curl -X GET http://127.0.0.1:8080/api/v1/server/health_checkcd ./docker/dev/ && ./up.shSome of the integration tests use Docker to spin up dependencies on demand (e.g., a postgres db),so please ensure Docker is installed before running the tests.
./test.shThis project uses config-rs to manage configuration.
settings
├── base.toml # default config file
├── dev.toml # development config file
├── prod.toml # production config file
└── test.toml # test config file
export PROD_APP__SERVER__PORT=8080
export PROD_APP__SERVER__ADDR=127.0.0.1Before running the application, export this variable:
export APP_PROFILE=prod # Switch to production profilecp ./scripts/git-hooks/* ./.git/hooks/cargo run --bin migration -- up -u $DATABASE_URLplanter postgres://username:password@localhost:5432/database_name\?sslmode=disable -o docs/schema.puml# Execute all test projects.
./testLicensed under either of
Contributors are welcome! please fork and send pull requests, If you find a bug or have any ideas on how to improve this project please submit an issue.
See CONTRIBUTING.md.
暂无开放 Issues,或尚未同步最近议题。