Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
Route Struct Reference

Represents a single HTTP route. More...

#include <RouteTypes.h>

+ Collaboration diagram for Route:

Public Member Functions

 Route (const std::string &m, const std::string &p, RouteHandler h, bool dynamic=false, bool auth=false, const std::vector< std::string > &params={})
 
 Route ()=default
 

Public Attributes

std::string method
 
std::string path
 
std::regex compiledRegex
 
RouteHandler handler
 
bool isDynamic
 
bool requiresAuth
 
std::vector< std::string > paramNames
 

Detailed Description

This structure encapsulates the method, path, handler function, and metadata about the route. It supports both static and dynamic routes, as well as authentication requirements.

Definition at line 41 of file RouteTypes.h.

Constructor & Destructor Documentation

◆ Route() [1/2]

Route::Route ( const std::string &  m,
const std::string &  p,
RouteHandler  h,
bool  dynamic = false,
bool  auth = false,
const std::vector< std::string > &  params = {} 
)
inline

Definition at line 51 of file RouteTypes.h.

56 {})
57 : method(m), path(p), compiledRegex(p), handler(h), isDynamic(dynamic), requiresAuth(auth), paramNames(params)
58 {
59 }
std::vector< std::string > paramNames
Definition RouteTypes.h:49
bool isDynamic
Definition RouteTypes.h:47
RouteHandler handler
Definition RouteTypes.h:46
bool requiresAuth
Definition RouteTypes.h:48
std::string method
Definition RouteTypes.h:43
std::string path
Definition RouteTypes.h:44
std::regex compiledRegex
Definition RouteTypes.h:45

◆ Route() [2/2]

Route::Route ( )
default

Member Data Documentation

◆ compiledRegex

std::regex Route::compiledRegex

Definition at line 45 of file RouteTypes.h.

Referenced by Router::handleRequest().

◆ handler

RouteHandler Route::handler

Definition at line 46 of file RouteTypes.h.

Referenced by Router::handleRequest().

◆ isDynamic

bool Route::isDynamic

Definition at line 47 of file RouteTypes.h.

Referenced by Router::printRoutes().

◆ method

std::string Route::method

Definition at line 43 of file RouteTypes.h.

◆ paramNames

std::vector<std::string> Route::paramNames

Definition at line 49 of file RouteTypes.h.

Referenced by Router::handleRequest().

◆ path

std::string Route::path

Definition at line 44 of file RouteTypes.h.

Referenced by Router::handleRequest(), and Router::printRoutes().

◆ requiresAuth

bool Route::requiresAuth

Definition at line 48 of file RouteTypes.h.

Referenced by Router::printRoutes().


The documentation for this struct was generated from the following file: