adding more comments
This commit is contained in:
parent
17bec04f2c
commit
380e81f8c9
1 changed files with 7 additions and 3 deletions
10
src/main.rs
10
src/main.rs
|
@ -20,12 +20,15 @@ use user::User;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let session_store = MemoryStore::default();
|
// for javascript and css
|
||||||
let session_layer = SessionManagerLayer::new(session_store).with_secure(false);
|
|
||||||
|
|
||||||
let assets_dir = std::env::current_dir().unwrap().join("assets");
|
let assets_dir = std::env::current_dir().unwrap().join("assets");
|
||||||
let assets_svc = ServeDir::new(assets_dir.as_path());
|
let assets_svc = ServeDir::new(assets_dir.as_path());
|
||||||
|
|
||||||
|
// just for signups
|
||||||
|
let session_store = MemoryStore::default();
|
||||||
|
let session_layer = SessionManagerLayer::new(session_store).with_secure(true);
|
||||||
|
|
||||||
|
// the core application, defining the routes and handlers
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.nest_service("/assets", assets_svc)
|
.nest_service("/assets", assets_svc)
|
||||||
.route("/signup", get(get_signup).post(post_signup))
|
.route("/signup", get(get_signup).post(post_signup))
|
||||||
|
@ -33,6 +36,7 @@ async fn main() {
|
||||||
.layer(session_layer)
|
.layer(session_layer)
|
||||||
.into_make_service();
|
.into_make_service();
|
||||||
|
|
||||||
|
// listing on the network
|
||||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
||||||
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
|
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
|
||||||
axum::serve(listener, app).await.unwrap();
|
axum::serve(listener, app).await.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue