mirror of
				https://github.com/bspeice/nutone
				synced 2025-11-03 18:00:56 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			633 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			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();
 | 
						|
}
 |