mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-26 23:58:35 -06:00
Added GZip compression
This commit is contained in:
parent
a14dbf5cd2
commit
51e75f726e
1 changed files with 3 additions and 2 deletions
|
@ -2,7 +2,7 @@ use std::env;
|
||||||
|
|
||||||
use actix_files::{Files, NamedFile};
|
use actix_files::{Files, NamedFile};
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
delete, get, post,
|
delete, get, middleware, post,
|
||||||
web::{self, Redirect},
|
web::{self, Redirect},
|
||||||
App, HttpResponse, HttpServer, Responder,
|
App, HttpResponse, HttpServer, Responder,
|
||||||
};
|
};
|
||||||
|
@ -74,13 +74,14 @@ async fn main() -> std::io::Result<()> {
|
||||||
.app_data(web::Data::new(AppState {
|
.app_data(web::Data::new(AppState {
|
||||||
db: database::open_db(env::var("db_url").unwrap_or("./urls.sqlite".to_string())),
|
db: database::open_db(env::var("db_url").unwrap_or("./urls.sqlite".to_string())),
|
||||||
}))
|
}))
|
||||||
|
.wrap(middleware::Compress::default())
|
||||||
.service(link_handler)
|
.service(link_handler)
|
||||||
.service(error404)
|
.service(error404)
|
||||||
.service(getall)
|
.service(getall)
|
||||||
.service(siteurl)
|
.service(siteurl)
|
||||||
.service(add_link)
|
.service(add_link)
|
||||||
.service(delete_link)
|
.service(delete_link)
|
||||||
.service(Files::new("/", "./resources/").index_file("index.html"))
|
.default_service(Files::new("/", "./resources/").index_file("index.html"))
|
||||||
})
|
})
|
||||||
.bind(("0.0.0.0", 2000))?
|
.bind(("0.0.0.0", 2000))?
|
||||||
.run()
|
.run()
|
||||||
|
|
Loading…
Reference in a new issue