1
0
mirror of https://github.com/bspeice/nutone synced 2025-07-05 16:04:47 -04:00
Files
nutone/src/main.rs
Bradlee Speice 474995194b Initial commit
Includes some unimportant files
2016-10-22 19:21:52 -04:00

32 lines
633 B
Rust

extern crate iron;
extern crate router;
use iron::Handler;
use iron::status;
use iron::IronResult;
use iron::Response;
use iron::Request;
use iron::Iron;
use router::Router;
struct EchoHandler {
message: String
}
impl Handler for EchoHandler {
fn handle(&self, _: &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok, self.message.clone())))
}
}
fn main() {
let echo = EchoHandler {
message: "FINALLY ARE YOU FREAKING KIDDING ME".to_string()
};
let mut router = Router::new();
router.get("/", echo, "index");
Iron::new(router).http("localhost:3000").unwrap();
}