init commit

This commit is contained in:
2020-01-12 23:53:10 +08:00
parent a1fa05a0df
commit 5d55a4e367
2 changed files with 22 additions and 0 deletions

10
Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "simple-rust-proxy"
version = "0.1.0"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
simple-server = "0.4.0"

12
src/main.rs Normal file
View File

@@ -0,0 +1,12 @@
use simple_server::Server;
fn main() {
let host = "127.0.0.1";
let port = "8080";
println!("Starting server @{}:{}...", host, port);
let server = Server::new(|_request, mut response| {
Ok(response.status(200).body("Hello, world!".as_bytes().to_vec())?)
});
server.listen(host, port);
}