1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00
examples/basics/middleware-ext-mut
2022-02-02 01:45:20 +00:00
..
src Update basics/middleware-ext-mut to v4 (#484) 2022-01-29 14:42:30 +00:00
Cargo.toml all versions are 1.0 2022-02-02 01:45:20 +00:00
README.md Update basics/middleware-ext-mut to v4 (#484) 2022-01-29 14:42:30 +00:00

middleware examples

This example showcases a middleware that adds and retrieves request-local data. See also the Middleware guide.

Usage

cd basics/middleware-ext-mut
cargo run
# Started http server: 127.0.0.1:8080

Look in src/add_msg.rs to see how it works.

Routes

  • GET /on - 200 OK with "hello from middleware" body and console log showing the request passed through the middleware
  • GET /off - 500 Internal Server Error with "no message found" body and console log showing the request passed through the middleware