aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: f97f60029e7ac4d88781f971f410d939072fbc97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![feature(proc_macro_hygiene, decl_macro)]

use rocket::{get, http::RawStr, routes, response::NamedFile};
use std::path::PathBuf;

#[get("/")]
fn index() -> &'static str {
    "Holahey, Jävlar!"
}

#[get("/<file>", rank = 99)]
fn public_file(file: &RawStr) -> Option<NamedFile> {
    NamedFile::open(PathBuf::from("public/").join(file.as_str())).ok()
}

fn main() {
    rocket::ignite().mount("/", routes![index, public_file]).launch();
}