Skip to content
 
 

Latest commit

 

History

128 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages