httpc
Loading...
Searching...
No Matches
node Struct Reference

#include <tree.h>

Data Fields

char * val
 a URI fsegment
 
struct nodechildren
 All nodes, whose routes include this node's val in their fsegment.
 
struct nodesiblings
 All nodes, whose routes include this node's, parent's, val in their fsegment.
 
callback_t callback
 The function that will be ran when a request comes.
 

Detailed Description

Conceptual

If we imagine A single URI is a linked list of nodes, then every registered URI on the server is an N-ary tree of nodes. This N-ary tree is how I've implemented URIs in this library.

Example

In the example below, some will have a child of silly, and silly will have a sibling of goofy. Both silly and goofy have their own children of uri (Note how every node will only point to one other node as "children", even though conceptually there can be many children via siblings). Assume every node has a callback, then the following endpoints will be served.

  1. /some
  2. /some/silly
  3. /some/silly/uri
  4. /some/goofy
  5. /some/goofy/uri

Legend:
--> : left's "children" points to right
|
v : top's "siblings" points to bottom

some --> silly --> uri
|
v
goofy --> uri

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