libexpress 0.0.1
Express Server Framework in C
|
This contains the router functions. More...
Go to the source code of this file.
Data Structures | |
struct | route_t |
Route. More... | |
struct | router_t |
Router. More... | |
Macros | |
#define | MID_END NULL |
A macro that defines the end of the middlewares in a router. More... | |
Typedefs | |
typedef u_int16_t | port_t |
Port number. | |
typedef router_t | server_t |
Functions | |
route_t * | find_route (router_t *router, req_t *req) |
Finds the router most appropriate for serving request. More... | |
void | route (router_t *router, const char *path, char *method,...) |
Assign Route for a specific method for a specific path. More... | |
void | route_get (router_t *router, const char *path,...) |
Assign a route for GET request for a router. More... | |
void | route_post (router_t *router, const char *path,...) |
Assign a route for POST request for a router. More... | |
void | route_put (router_t *router, const char *path,...) |
Assign a route for PUT request for a router. More... | |
void | route_delete (router_t *router, const char *path,...) |
Assign a route for DELETE request for a router. More... | |
This contains the router functions.
It contains and imports all the functions of router that are made available.
#define MID_END NULL |
A macro that defines the end of the middlewares in a router.
It defines the end of the middlewares in a route and is to be used as a parameter before the final controller.
Finds the router most appropriate for serving request.
router | Router |
req | Request Instance |
void route | ( | router_t * | router, |
const char * | path, | ||
char * | method, | ||
... | |||
) |
Assign Route for a specific method for a specific path.
router | Router instance, can be server instance as well |
path | Path for router, only part of it which should be it's path if the tree of router hierarchy is maintained |
method | The method of the HTTP requests |
... | Any number of controllers or middlewares of the type controller_t* |
void route_delete | ( | router_t * | router, |
const char * | path, | ||
... | |||
) |
Assign a route for DELETE request for a router.
router | Router instance, can be server instance as well |
path | Path for router, only part of it which should be it's path if the tree of router hierarchy is maintained |
... | Any number of controllers or middlewares of the type controller_t* |
void route_get | ( | router_t * | router, |
const char * | path, | ||
... | |||
) |
Assign a route for GET request for a router.
router | Router instance, can be server instance as well |
path | Path for router, only part of it which should be it's path if the tree of router hierarchy is maintained |
... | Any number of controllers or middlewares of the type controller_t* |
void route_post | ( | router_t * | router, |
const char * | path, | ||
... | |||
) |
Assign a route for POST request for a router.
router | Router instance, can be server instance as well |
path | Path for router, only part of it which should be it's path if the tree of router hierarchy is maintained |
... | Any number of controllers or middlewares of the type controller_t* |
void route_put | ( | router_t * | router, |
const char * | path, | ||
... | |||
) |
Assign a route for PUT request for a router.
router | Router instance, can be server instance as well |
path | Path for router, only part of it which should be it's path if the tree of router hierarchy is maintained |
... | Any number of controllers or middlewares of the type controller_t* |