Skip to content

Instantly share code, notes, and snippets.

@up1
Last active September 21, 2020 11:59
Show Gist options
  • Save up1/6c7495ec71c0fa775c5e to your computer and use it in GitHub Desktop.
Save up1/6c7495ec71c0fa775c5e to your computer and use it in GitHub Desktop.
Hello world with Rust :: web application
[package]
name = "simple-web"
version = "0.1.0"
authors = ["somkiat <[email protected]>"]
[dependencies.nickel]
git = "https://github.com/nickel-org/nickel.rs.git"
fn main() {
println!("Hello world");
}
#[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");
}
#[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