#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use rocket_seek_stream::SeekStream;
#[get("/memory")]
fn hello<'a>() -> SeekStream<'a> {
let bytes = &include_bytes!("./cruel_angels_thesis.webm")[..];
let len = bytes.len();
let stream = std::io::Cursor::new(bytes);
SeekStream::with_opts(stream, len as u64, "video/webm")
}
#[get("/from_path")]
fn from_path<'a>() -> std::io::Result<SeekStream<'a>> {
SeekStream::from_path("fly_me_to_the_moon.webm")
}
#[get("/long")]
fn long<'a>() -> std::io::Result<SeekStream<'a>> {
SeekStream::from_path("tari_tari.webm")
}
#[get("/")]
fn longer<'a>() -> std::io::Result<SeekStream<'a>> {
SeekStream::from_path("ison.webm")
}
#[launch]
fn rocket() -> _ {
let config = {
let mut config = rocket::Config::default();
config.port = 8000;
config
};
rocket::Rocket::custom(config)
.mount("/", routes![hello, from_path, long, longer])
}