1
0
mirror of https://github.com/actix/examples synced 2024-11-30 17:14:35 +01:00
examples/middleware/middleware-ext-mut
2023-03-14 03:11:49 +00:00
..
src standardize examples 2023-03-14 03:11:49 +00:00
Cargo.toml move a couple more things to workspace deps 2023-01-02 20:33:43 +00:00
README.md fix static-files readme name 2022-02-18 03:36:04 +00:00

Middleware: Add/Retrieve Request-Local Data

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

Usage

cd middleware/middleware-ext-mut
cargo run

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