HTTP routing with middleware and optional JWT-based authorization. Part of the PicoFramework HTTP server. This module provides the Router class, which manages HTTP routes, middleware, and optional JWT authentication. It allows dynamic route registration, regex-based path matching, and supports global and per-route middleware. The Router can handle requests, invoke appropriate handlers, and apply middleware functions in sequence. It also includes a built-in route handler for testing JWT tokens at the /auth endpoint.
More...
#include <vector>
#include <string>
#include <unordered_map>
#include <functional>
#include <FreeRTOS.h>
#include <semphr.h>
#include "http/RouteTypes.h"
#include "http/HttpRequest.h"
#include "http/HttpResponse.h"
#include "http/HttpFileserver.h"
Go to the source code of this file.
|
class | Router |
| The central router for handling HTTP requests and middleware. More...
|
|
- Author
- Ian Archbell
- Version
- 0.1
- Date
- 2025-03-26
- License:\n MIT License
Definition in file Router.h.
◆ Middleware
Middleware may short-circuit request handling by returning false.
Definition at line 48 of file Router.h.
◆ RouteHandler
Route handlers receive the parsed request, response object, and any captured parameters from dynamic paths (e.g., /device/{id}).
Definition at line 41 of file Router.h.