Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
Loading...
Searching...
No Matches
admin.h File Reference

Unified administration and monitoring controller for the csilk framework. More...

#include "csilk/app/app.h"
#include "csilk/csilk.h"
Include dependency graph for admin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void csilk_admin_serve (csilk_app_t *app, const char *path)
 Register administration routes to an application.
 
void csilk_admin_serve_secure (csilk_app_t *app, const char *path, csilk_handler_t auth_middleware)
 Register protected administration routes to an application.
 

Detailed Description

Unified administration and monitoring controller for the csilk framework.

Provides a web-based dashboard for real-time observability of HTTP metrics, AI Workflows, and the Internal Message Queue.

Function Documentation

◆ csilk_admin_serve()

void csilk_admin_serve ( csilk_app_t *  app,
const char *  path 
)

Register administration routes to an application.

This function registers several routes under the given path:

  • GET <path> : Serves the HTML dashboard UI.
  • GET <path>/stats : Returns a JSON snapshot of all system metrics.
  • GET <path>/ws : WebSocket endpoint for real-time event streaming.
Parameters
appThe application handle.
pathThe base URL path for the admin panel (e.g., "/admin").
Note
Requires the server to be running and WebSocket support enabled.

◆ csilk_admin_serve_secure()

void csilk_admin_serve_secure ( csilk_app_t *  app,
const char *  app_path,
csilk_handler_t  auth_middleware 
)

Register protected administration routes to an application.

Similar to csilk_admin_serve, but wraps all admin routes in the provided auth_middleware. This ensures that the dashboard, stats, and WebSocket endpoints are only accessible to authorized users.

Parameters
appThe application handle.
pathThe base URL path for the admin panel.
auth_middlewareThe middleware to use for authentication.

Register protected administration routes to an application.

This implementation creates a new route group for the admin panel, applying an optional authentication middleware. This ensures that sensitive metrics and real-time data are only accessible to authorized users.

Parameters
appThe high-level application handle.
app_pathThe base URL path for the admin panel (e.g., "/admin").
auth_middlewareOptional handler function for authentication.