October 2019
Intermediate to advanced
444 pages
10h 37m
English
Perform the following steps to implement this recipe:
#[macro_use]extern crate actix_web;use actix_web::{ guard, http::Method, middleware, web, App, HttpResponse, HttpServer,};use serde_derive::{Deserialize, Serialize};use std::env;
#[derive(Debug, Clone, Serialize, Deserialize)]struct Bookmark { id: i32, url: String,}#[get("by-id/{id}")]fn bookmarks_by_id(id: web::Path<(i32)>) -> HttpResponse { let bookmark = Bookmark { id: *id, url: "https://blog.x5ff.xyz".into(), }; HttpResponse::Ok().json(bookmark)}fn echo_bookmark(bookmark: web::Json<Bookmark>) ...Read now
Unlock full access