Can I service static html with include_str! macro (ie include it in my binary)? #2989
-
Hello and thank you for this amazing lib! At the moment I include a static index.html in my App with last service call in the App builder like this:
I would like to include the file ( Can I achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
let index = include_str!("./index.html");
HttpResponse::Ok()
.content_type(ContentType::html())
.body(index)
# or from actix-web-lab
Html::new(index) If there's more files you want to include statically, there's this lib: https://docs.rs/actix-web-static-files |
Beta Was this translation helpful? Give feedback.
If there's more files you want to include statically, there's this lib: https://docs.rs/actix-web-static-files