Skip to content
/ luna Public
forked from DEGoodmanWilson/luna

Idiomatic C++ embedded HTTP server based on libmicrohttpd

License

Notifications You must be signed in to change notification settings

boks1971/luna

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status badge

luna

An embedded HTTP server in idiomatic C++

-or-

A C++ wrapper for libmicrohttpd

#include <string>
#include <iostream>
#include <luna/server.h>

using namespace luna;

int main(void)
{
    server server{server::mime_type{"text/json"}, server::port{8443}}

    server.handle_request(request_method::GET, "/ohyeah", [](auto request) -> response
        {
            return {"{\"koolade\": true}"};
        });

    server.handle_request(request_method::GET, "^/documents/(i[0-9a-f]{6})", [](auto request) -> response
        {
            auto document_id = request.matches[1];
            return {"text/html", "<h1>Serving up document "+document_id+"</h1>"};
        });

    while (server); //idle while the server is running. Maybe not the best way? //TODO how to signal to server to die
}

TODO

  • Fix the way POSTDATA is handled so that we have a default handler, and a more sophisticated handler. Not super happy with the current flow.
  • docs docs docs

About

Idiomatic C++ embedded HTTP server based on libmicrohttpd

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 92.7%
  • CMake 4.3%
  • Python 2.8%
  • C 0.2%