2020-10-22 00:17:52 +02:00
|
|
|
mod db;
|
|
|
|
mod routes;
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate diesel;
|
|
|
|
extern crate chrono;
|
|
|
|
extern crate serde_derive;
|
|
|
|
extern crate tera;
|
|
|
|
|
|
|
|
use actix_files as fs;
|
2020-10-22 16:52:04 +02:00
|
|
|
use actix_web::{middleware, App, HttpServer};
|
|
|
|
use std::string::String;
|
2020-10-22 00:17:52 +02:00
|
|
|
|
|
|
|
#[actix_web::main]
|
|
|
|
async fn main() -> std::io::Result<()> {
|
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
2020-10-22 16:52:04 +02:00
|
|
|
//.wrap(middleware::NormalizePath::default())
|
2020-10-22 00:17:52 +02:00
|
|
|
.service(routes::root)
|
|
|
|
.service(routes::blog)
|
|
|
|
.service(routes::blog_permalink)
|
2020-10-22 16:52:04 +02:00
|
|
|
.service(routes::blog_submit)
|
|
|
|
.service(routes::blog_new_post)
|
2020-10-22 00:17:52 +02:00
|
|
|
.service(fs::Files::new("/static", "./static/"))
|
|
|
|
})
|
|
|
|
.bind("localhost:8000")?
|
|
|
|
.run()
|
|
|
|
.await
|
|
|
|
}
|