Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
HttpWebServer.h
1// Copyright (c) Stefano Cristiano
2// SPDX-License-Identifier: MIT
3#pragma once
4#include "../Strings/String.h"
5#include "HttpServer.h"
6
7namespace SC
8{
9struct SC_COMPILER_EXPORT HttpWebServer;
10}
11
21{
23 Result init(StringView directoryToServe);
24
27
30 void serveFile(HttpRequest& request, HttpResponse& response);
31
32 private:
33 String directory;
34
35 struct Internal;
36};
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition Compiler.h:78
Http request received from a client.
Definition HttpServer.h:48
Http response that will be sent to a client.
Definition HttpServer.h:77
Http web server helps statically serves files from a directory.
Definition HttpWebServer.h:21
void serveFile(HttpRequest &request, HttpResponse &response)
Serve the file requested by this Http Client on its channel Call this method in response to HttpServe...
Result stopAsync()
Release all resources allocated by this web server.
Result init(StringView directoryToServe)
Initialize the web server on the given file system directory to serve.
An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
Definition Result.h:12
Non-owning view over a range of characters with UTF Encoding.
Definition StringView.h:47
A non-modifiable owning string with associated encoding.
Definition String.h:29