From d15b1f832946a740eb53ba828bdbebd5a7b54fb8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 7 Nov 2017 01:34:18 +0100 Subject: main.rs: Add web server and "hello world" route Basic web server and dummy response using 'rouille'. --- src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e7a11a9..d5f89ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,15 @@ +#[macro_use] +extern crate rouille; + + fn main() { - println!("Hello, world!"); + rouille::start_server("localhost:8000", move |request| { + router!(request, + (GET) (/) => { + rouille::Response::text("hello world") + }, + + _ => rouille::Response::empty_404() + ) + }); } -- cgit v1.2.3