Migrate to actix-web #8
|
@ -15,6 +15,10 @@ struct Config {
|
||||||
#[clap(long, default_value = "127.0.0.1:8000", value_parser)]
|
#[clap(long, default_value = "127.0.0.1:8000", value_parser)]
|
||||||
/// The address on which to listen
|
/// The address on which to listen
|
||||||
address: SocketAddr,
|
address: SocketAddr,
|
||||||
|
#[clap(long, action)]
|
||||||
|
/// Whether to start the server in dev mode; this enables some
|
||||||
|
/// nice handlebars features that are not intended for production
|
||||||
|
dev_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SharedData<'a> {
|
struct SharedData<'a> {
|
||||||
|
@ -88,6 +92,7 @@ async fn main() -> Result<(), std::io::Error> {
|
||||||
handlebars
|
handlebars
|
||||||
.register_templates_directory(".html", config.template_directory.clone())
|
.register_templates_directory(".html", config.template_directory.clone())
|
||||||
.expect("templates should compile correctly");
|
.expect("templates should compile correctly");
|
||||||
|
handlebars.set_dev_mode(config.dev_mode);
|
||||||
|
|
||||||
let shared_data = web::Data::new(SharedData {
|
let shared_data = web::Data::new(SharedData {
|
||||||
handlebars,
|
handlebars,
|
||||||
|
|
Loading…
Reference in a new issue