tildefriends/src/httpd.js.h

42 lines
985 B
C

#pragma once
/**
** \defgroup httpd_js HTTPD Interface
** Exposes the \ref http server to script and registers a number of built-in
** endpoints.
**
** core/core.js is gradually being moved from JS to C here, at which point this will
** no longer be a bridge between the two and instead primarily expose the web API.
**
** @{
*/
#include "quickjs.h"
/**
** An HTTP server instance.
*/
typedef struct _tf_http_t tf_http_t;
/**
** Register the HTTP script interface. Also registers a number of built-in
** request handlers. An ongoing project is to move the JS request handlers
** into C, after which point this will only do the latter.
** @param context The JS context.
*/
void tf_httpd_register(JSContext* context);
/**
** Create the HTTP server instance.
** @param context The JS context.
*/
tf_http_t* tf_httpd_create(JSContext* context);
/**
** Destroy the HTTP server instance.
** @param http The HTTP server instance.
*/
void tf_httpd_destroy(tf_http_t* http);
/** @} */