initial commit, simple http route
This commit is contained in:
commit
746701cfbf
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/target
|
||||||
1475
Cargo.lock
generated
Normal file
1475
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "telestrations"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Peter Hart <cinphart@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
actix-web = "2"
|
||||||
|
actix-rt = "1"
|
||||||
14
src/main.rs
Normal file
14
src/main.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
use actix_web::{get, web, App, HttpServer, Responder};
|
||||||
|
|
||||||
|
#[get("/{id}/{name}/index.html")]
|
||||||
|
async fn index(info: web::Path<(u32, String)>) -> impl Responder {
|
||||||
|
format!("Hello {}! id:{}", info.1, info.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[actix_rt::main]
|
||||||
|
async fn main() -> std::io::Result<()> {
|
||||||
|
HttpServer::new(|| App::new().service(index))
|
||||||
|
.bind("0.0.0.0:8080")?
|
||||||
|
.run()
|
||||||
|
.await
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user