myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
Loading...
Searching...
No Matches
Classes | Functions
Server.hpp File Reference

The small HTTP server behind --http: the page and its JSON API. More...

#include <cstdint>
#include <filesystem>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  tinysql::ServerConfig
 Settings of the browser server. More...
 

Functions

void tinysql::runServer (const ServerConfig &config)
 Serves connections until the process is stopped.
 

Detailed Description

The small HTTP server behind --http: the page and its JSON API.

Definition in file Server.hpp.

Function Documentation

◆ runServer()

void tinysql::runServer ( const ServerConfig &  config)

Serves connections until the process is stopped.

It serves the page's files from ServerConfig::webDir and a small JSON API: GET /api/tables lists the tables, POST /api/sql runs the SQL in the request body. Each connection is served in its own thread; the SQL itself runs one request at a time.

Parameters
configThe server settings.
Exceptions
std::system_errorIf the port cannot be opened (for example, it is already in use).

Definition at line 312 of file Server.cpp.