Make this bih multithreaded

This commit is contained in:
kamkow1
2025-06-16 01:20:11 +02:00
parent bfcc66ff2a
commit a532d5b03d
4 changed files with 162 additions and 41 deletions

View File

@ -1,13 +1,33 @@
#ifndef ROUTES_H_
#define ROUTES_H_
#include "gebs/gebs.h"
#include "mongoose/mongoose.h"
void route_page_not_found(struct mg_connection *conn, struct mg_http_message *msg);
void route_simple_css(struct mg_connection *conn, struct mg_http_message *msg);
void route_favicon(struct mg_connection *conn, struct mg_http_message *msg);
void route_hotreload_js(struct mg_connection *conn, struct mg_http_message *msg);
void route_home(struct mg_connection *conn, struct mg_http_message *msg);
void route_build_id(struct mg_connection *conn, struct mg_http_message *msg);
typedef struct {
int status_code;
NString_List headers;
String_Builder body;
} Route_Result;
typedef struct {
struct mg_mgr *mgr;
ulong conn_id;
struct mg_str message;
} Route_Thread_Data;
typedef void (*Route_Handler)(struct mg_http_message *msg, Route_Result *result);
typedef struct {
char *key; // path
Route_Handler value;
} Route;
void route_page_not_found(struct mg_http_message *msg, Route_Result *result);
void route_simple_css(struct mg_http_message *msg, Route_Result *result);
void route_favicon(struct mg_http_message *msg, Route_Result *result);
void route_hotreload_js(struct mg_http_message *msg, Route_Result *result);
void route_home(struct mg_http_message *msg, Route_Result *result);
void route_build_id(struct mg_http_message *msg, Route_Result *result);
#endif // ROUTES_H_