#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use rocket_seek_stream::SeekStream;
#[get("/")]
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("kosmodrom.webm")
}
fn main() {
rocket::Rocket::custom(
rocket::Config::build(rocket::config::Environment::Development)
.address("localhost")
.port(8000)
.finalize()
.unwrap(),
)
.mount("/", routes![hello, from_path, long,])
.launch();
}