Created
June 2, 2015 11:53
-
-
Save kreshikhin/e3c0764dcbe42dd9120b to your computer and use it in GitHub Desktop.
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
extern crate http; | |
extern crate nickel; | |
use std::io::File; | |
use std::str::from_utf8_owned; | |
use std::io::net::ip::Ipv4Addr; | |
use nickel::{ Nickel, Request, Response }; | |
fn main() { | |
let mut server = Nickel::new(); | |
fn a_handler (_request: &Request, response: &mut Response) { | |
response.send("<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Welcome to nginx!</title> | |
<style> | |
body { | |
width: 35em; | |
margin: 0 auto; | |
font-family: Tahoma, Verdana, Arial, sans-serif; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Welcome to nginx!</h1> | |
<p>If you see this page, the nginx web server is successfully installed and | |
working. Further configuration is required.</p> | |
<p>For online documentation and support please refer to | |
<a href=\"http://nginx.org/\">nginx.org</a>.<br/> | |
Commercial support is available at | |
<a href=\"http://nginx.com/\">nginx.com</a>.</p> | |
<p><em>Thank you for using nginx.</em></p> | |
</body> | |
</html> | |
"); | |
} | |
server.get("/", a_handler); | |
server.listen(Ipv4Addr(127, 0, 0, 1), 6767); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment