Last active
September 21, 2020 11:59
-
-
Save up1/6c7495ec71c0fa775c5e to your computer and use it in GitHub Desktop.
Hello world with Rust :: web application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "simple-web" | |
version = "0.1.0" | |
authors = ["somkiat <[email protected]>"] | |
[dependencies.nickel] | |
git = "https://github.com/nickel-org/nickel.rs.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("Hello world"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] extern crate nickel; | |
use nickel::Nickel; | |
fn main() { | |
let mut server = Nickel::new(); | |
server.utilize(router! { | |
get "**" => |_req, _res| { | |
"Hello world" | |
} | |
}); | |
server.listen("127.0.0.1:6767"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] extern crate nickel; | |
use nickel::Nickel; | |
fn main() { | |
let mut server = Nickel::new(); | |
server.utilize(router! { | |
get "**" => |_req, _res| { | |
hello() | |
} | |
}); | |
server.listen("127.0.0.1:6767"); | |
} | |
fn hello() -> &'static str { | |
"Hello world" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment