warp-tpl
is a simple template for rust warp web framework.
├─app
│ │ Cargo.toml
│ │
│ └─src
│ │ auth.rs
│ │ errors.rs
│ │ main.rs
│ │ state.rs
│ │ views.rs
│ │
│ └─views
│ index.rs
│
└─macros
│ Cargo.toml
│
└─src
lib.rs
macros
proc crate to convertasync fn xxx() -> Result<_, OtherError>
toasync fn xxx() -> Result<_, Rejection>
which is required inwarp
. Typically you could ignore this crate.app
in which you write your web code.app/src/auth.rs
example for app authorization.app/src/errors.rs
contains user defined errors and code required to generatewarp::Reply
app/src/state.rs
place app state like database or config used in route function in this file.app/src/views.rs
register your api route inbuild_filter
.app/src/views/*.rs
app route goes here.app/src/main.rs
entry of your app, init config, connect to database, etc.
git clone https://github.com/tyan-boot/warp-tpl
then write your code in app
.
PRs and issues are welcome.