Http¶
| Spice | |
|---|---|
HttpServer struct¶
Struct, representing a simple HTTP server
Constructors¶
ctor¶
| Spice | |
|---|---|
Used to initialize a HTTP server instance, listening on a specific port for incoming requests
Parameters
| Name | Type | Description |
|---|---|---|
port |
unsigned short |
(default: HTTP_PORT_DEFAULT) |
Methods¶
start¶
| Spice | |
|---|---|
Returns: bool
serve¶
| Spice | |
|---|---|
Register a route on the server that responds with the given HTML content
Parameters
| Name | Type | Description |
|---|---|---|
path |
string |
Request path to serve |
htmlContent |
string |
HTML content to respond with |
Returns: bool — true if the route was registered successfully, false otherwise