aboutsummaryrefslogtreecommitdiff
path: root/src/webserver/rocket.rs
blob: ac7401b5b27cc937448261c0692da40ccc159afa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use rocket::response::content;
use rocket::{State, get, post, request::Form, routes};
use rocket::response::NamedFile;
// use std::sync::Arc;
use crate::webserver::model::*;

pub async fn start_rocket() -> WispResult { // ctx: WispData
    rocket::ignite()
        .mount("/", routes![
            icon, index
        ]).launch();

    Ok(())
}

#[get("/favicon.ico")]
pub fn icon() -> Option<NamedFile> {
    NamedFile::open("static/favicon.ico").ok()
}

#[get("/")]
pub fn index() -> content::Json<&'static str> {
    content::Json("{\"message\": \"online\"}")
}