mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[ADD/WIP] Routerwerk!
This commit is contained in:
parent
25ed114d0f
commit
47c98cbbe3
8 changed files with 280 additions and 1 deletions
35
src/ParseeData.c
Normal file
35
src/ParseeData.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <Parsee.h>
|
||||
|
||||
#include <Cytoplasm/Memory.h>
|
||||
|
||||
#include <Routes.h>
|
||||
|
||||
ParseeData *
|
||||
ParseeInitData(void)
|
||||
{
|
||||
ParseeData *data;
|
||||
if (!ParseeConfigGet())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = Malloc(sizeof(*data));
|
||||
data->config = ParseeConfigGet();
|
||||
data->router = HttpRouterCreate();
|
||||
|
||||
#define X_ROUTE(path, func) HttpRouterAdd(data->router, path, func);
|
||||
ROUTES
|
||||
#undef X_ROUTE
|
||||
return data;
|
||||
}
|
||||
void
|
||||
ParseeFreeData(ParseeData *data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HttpRouterFree(data->router);
|
||||
Free(data);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue