update doc server to ctorm 1.8.1

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn
2025-05-22 20:12:05 +03:00
parent a9d2633107
commit 912bf616b6
29 changed files with 178 additions and 122 deletions

View File

@ -1,3 +1,4 @@
#include <ctorm/app.h>
#include <ctorm/ctorm.h>
#include <stdlib.h>
@ -19,25 +20,28 @@ int main() {
return EXIT_FAILURE;
}
// initialize the app config
ctorm_config_new(&app_config);
app_config.disable_logging = true;
app = ctorm_app_new(&app_config);
// create a new app
app = ctorm_app_new(&app_config);
// middlewares
MIDDLEWARE_ALL(app, "/*", route_cors);
MIDDLEWARE_ALL(app, "/*/*", route_cors);
ALL(app, "/*", route_cors);
ALL(app, "/*/*", route_cors);
// routes
GET(app, "/list", route_list);
GET(app, "/get/:name", route_get);
ctorm_app_all(app, route_notfound);
ctorm_app_default(app, route_notfound);
ctorm_app_local(app, "config", &conf);
ctorm_info("starting the web server on %s", host);
if (!ctorm_app_run(app, host))
ctorm_fail("failed to start the app: %s", ctorm_geterror());
ctorm_fail("failed to start the app: %s", ctorm_error());
ctorm_app_free(app);
return EXIT_SUCCESS;