2018-05-24 10:13:55 -07:00
|
|
|
// <path>
|
2019-06-28 13:31:30 -04:00
|
|
|
use actix_web::{web, Result};
|
2018-05-24 10:13:55 -07:00
|
|
|
|
2019-06-17 02:08:42 -04:00
|
|
|
fn index(info: web::Path<(String, u32)>) -> Result<String> {
|
2018-05-24 10:13:55 -07:00
|
|
|
Ok(format!("Welcome {}! id: {}", info.0, info.1))
|
|
|
|
}
|
|
|
|
|
2019-06-19 00:20:50 -04:00
|
|
|
pub fn main() {
|
2019-06-28 13:31:30 -04:00
|
|
|
use actix_web::{App, HttpServer};
|
2019-06-25 18:20:36 -04:00
|
|
|
|
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new().route(
|
|
|
|
"/{username}/{id}/index.html", // <- define path parameters
|
|
|
|
web::get().to(index),
|
|
|
|
)
|
|
|
|
})
|
|
|
|
.bind("127.0.0.1:8088")
|
|
|
|
.unwrap()
|
|
|
|
.run()
|
|
|
|
.unwrap();
|
2018-05-24 10:13:55 -07:00
|
|
|
}
|
|
|
|
// </path>
|