init commit
This commit is contained in:
10
Cargo.toml
Normal file
10
Cargo.toml
Normal 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
12
src/main.rs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user