You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
729 B
30 lines
729 B
use actix_web::{post, web, App, HttpResponse, HttpServer, Responder};
|
|
use actix_files;
|
|
|
|
use mdnotes::commons::{Arguments, AppData};
|
|
use mdnotes::index;
|
|
|
|
#[actix_web::main]
|
|
async fn main() -> std::io::Result<()> {
|
|
|
|
let args = Arguments::parse_args();
|
|
|
|
let ip = args.ip;
|
|
let port = args.port;
|
|
|
|
let appdata = AppData {
|
|
name: String::from("MdNotes"),
|
|
};
|
|
|
|
HttpServer::new(move || {
|
|
App::new()
|
|
.app_data(web::Data::new(appdata.to_owned()))
|
|
.service(index::index)
|
|
.service(actix_files::Files::new("/static", "./static"))
|
|
.service(actix_files::Files::new("/static/modules", "./static/modules"))
|
|
})
|
|
.bind((ip, port))?
|
|
.run()
|
|
.await
|
|
}
|