update
This commit is contained in:
parent
008648dda8
commit
cd10c64a1f
3 changed files with 104 additions and 39 deletions
27
examples/static.rs
Normal file
27
examples/static.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use based::get_pg;
|
||||
use based::request::RequestContext;
|
||||
|
||||
use rocket::get;
|
||||
use rocket::response::Responder;
|
||||
use rocket::routes;
|
||||
|
||||
#[get("/")]
|
||||
pub async fn index_page<'r>(ctx: RequestContext) -> impl Responder<'r, 'static> {
|
||||
based::request::assets::DataResponse::new(
|
||||
include_bytes!("../Cargo.toml").to_vec(),
|
||||
"text/toml",
|
||||
Some(60 * 60 * 3),
|
||||
)
|
||||
}
|
||||
|
||||
#[rocket::launch]
|
||||
async fn launch() -> _ {
|
||||
// Logging
|
||||
env_logger::init();
|
||||
|
||||
// Database
|
||||
let pg = get_pg!();
|
||||
// sqlx::migrate!("./migrations").run(pg).await.unwrap();
|
||||
|
||||
rocket::build().mount("/", routes![index_page])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue