October 2019
Intermediate to advanced
444 pages
10h 37m
English
We are going to set up and run our own web server in just a few steps:
#[macro_use]extern crate actix_web;use actix_web::{web, App, middleware, HttpServer, Responder, Result};use std::{env};use actix_files as fs;fn index() -> Result<fs::NamedFile> { Ok(fs::NamedFile::open("static/index.html")?)}
fn path_parser(info: web::Path<(String, i32)>) -> impl Responder { format!("You tried to reach '{}/{}'", info.0, info.1)}fn rust_cookbook() -> impl Responder { format!("Welcome ...