httpc
Loading...
Searching...
No Matches
httplib.h File Reference
#include "tree.h"

Go to the source code of this file.

Enumerations

enum  ERROR_CODES { RR_DUPLICATE_ROUTE , RR_OK }
 

Functions

int get (char route[], callback_t callback)
 add an endpoint for a "GET" request at the given endpoint
 
int post (char route[], callback_t callback)
 
int register_route (char route[], callback_t callback, node *root_node)
 adds a route to the URI tree
 
int http_listen (void)
 
void setup (void)
 this needs to be ran before registering any routes.
 

Variables

node get_root
 
node post_root
 

Function Documentation

◆ http_listen()

int http_listen ( void )

TODO: Create the server

◆ register_route()

int register_route ( char route[],
callback_t callback,
node * root_node )

adds a route to the URI tree

Parameters
routean HTTP verb with a route, separated by a space. (eg. "GET /some/complete/route")
callbackthe function to be ran when a request comes in for the given route
root_nodethe root in which to add this new node, typically either the get root or post root
Returns
one of ERROR_CODES