This is a small WebServer library written on top of the MulleFoundation.
It contains an HTTP server and support for JSON. It is experimental at this stage.
Release Version | Release Notes |
---|---|
RELEASENOTES |
Serving a NSDictionary to the net can be done like this:
//
// define a handler to service web requests, that answers
// http://<host>:8080/foo requests
//
@interface MyWebRequestHandler : MulleObject <MulleCivetWebRequestHandler,
MulleAutolockingObjectProtocols>
@end
@implementation MyWebRequestHandler
- (MulleCivetWebResponse *) webServer:(MulleCivetWebServer *) server
webResponseForWebRequest:(MulleCivetWebRequest *) request
{
MulleCivetWebTextResponse *response;
NSDictionary *dictionary;
if( [[[request URL] path] isEqualToString:@"foo"])
{
response = [MulleCivetWebTextResponse webResponseForWebRequest:request];
dictionary = @{ @"foo": @"VfL Bochum 1848" };
[response appendLine:[dictionary mulleJSONDescription]];
return( response);
}
return( nil);
}
@end
int main( void)
{
MyWebRequestHandler *handler;
MulleCivetWebServer *server;
// install request handler in server
handler = [MyWebRequestHandler object];
server = [MulleCivetWebServer object];
[server setRequestHandler:handler];
// let server run until CTRL-C or signal
for(;getchar() != 'q';);
return( 0);
}
This library ties MulleCivetWebServer to MulleObjCOSFoundation to gain logging functionality.
Use mulle-sde to add MulleWebServer to your project:
mulle-sde add github:MulleWeb/MulleWebServer
Use mulle-sde to build and install MulleWebServer and all dependencies:
mulle-sde install --prefix /usr/local \
https://github.com//MulleWebServer/archive/latest.tar.gz
Install the requirements:
Requirements | Description |
---|---|
MulleCivetWeb | π¦ HTTP Server for mulle-objc |
MulleObjCJSMNFoundation | πΌ JSON support for mulle-objc |
MulleFoundation | π Umbrella library for the MulleFoundation |
mulle-objc-list | π Lists mulle-objc runtime information contained in executables. |
Download the latest tar or zip archive and unpack it.
Install MulleWebServer into /usr/local
with cmake:
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=/usr/local \
-DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release
All platforms and compilers supported by mulle-c11.
Nat! for Mulle kybernetiK