use actix_web::{
App, HttpServer,
http::header::{CacheControl, CacheDirective},
};
use vite_static::{ActixFiles, Manifest};
#[derive(Manifest)]
#[vite_dist = "examples/vite-project/dist"]
struct MyViteStatic;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(
ActixFiles::new("/", MyViteStatic.boxed())
.cache_control(CacheControl(vec![CacheDirective::MaxAge(3600 * 6)])),
)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}