All Projects → DEGoodmanWilson → Luna

DEGoodmanWilson / Luna

Licence: mit
Yet another web framework—this time in modern C++!

Projects that are alternatives of or similar to Luna

Bingo
简洁优雅的 Go Web 框架(暂不更新,预计一年后继续更新)
Stars: ✭ 119 (+20.2%)
Mutual labels:  api, webframework
Spock
Another Haskell web framework for rapid development
Stars: ✭ 623 (+529.29%)
Mutual labels:  api, webframework
Lambda Api
Lightweight web framework for your serverless applications
Stars: ✭ 929 (+838.38%)
Mutual labels:  api, webframework
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-3.03%)
Mutual labels:  api
Opensubtitles Api
nodejs opensubtitles.org api wrapper for downloading and uploading subtitles in multiple langs
Stars: ✭ 96 (-3.03%)
Mutual labels:  api
Rest And Go
A basic online store REST API written with Golang
Stars: ✭ 98 (-1.01%)
Mutual labels:  api
Cryptocurrency Cli
💰 Cryptocurrency Portfolio On The Command Line 💰
Stars: ✭ 99 (+0%)
Mutual labels:  api
Python Binance Chain
Binance Chain Exchange API python implementation for automated trading
Stars: ✭ 96 (-3.03%)
Mutual labels:  api
Jamfproscripts
A collection of shell scripts created for use in Jamf Pro and elsewhere
Stars: ✭ 98 (-1.01%)
Mutual labels:  api
Open Semantic Entity Search Api
Open Source REST API for named entity extraction, named entity linking, named entity disambiguation, recommendation & reconciliation of entities like persons, organizations and places for (semi)automatic semantic tagging & analysis of documents by linked data knowledge graph like SKOS thesaurus, RDF ontology, database(s) or list(s) of names
Stars: ✭ 98 (-1.01%)
Mutual labels:  api
Twig
Twig - less is more's web server for golang
Stars: ✭ 98 (-1.01%)
Mutual labels:  webframework
Miraql
GraphQL performance monitoring & error-handling tool
Stars: ✭ 97 (-2.02%)
Mutual labels:  api
Binance.api.csharp.client
C#.NET client for Binance Exchange API.
Stars: ✭ 98 (-1.01%)
Mutual labels:  api
Shellfuncs
Python API to execute shell functions as they would be Python functions
Stars: ✭ 96 (-3.03%)
Mutual labels:  api
Osint San
Framework для сбора данных из открытых источников. В Framework используется большое количество API, их необходимо зарегистрировать самому.​
Stars: ✭ 99 (+0%)
Mutual labels:  api
Satis Server
🐳 Private, self-hosted Composer/Satis repository with unlimited private and open-source packages and support for Git, Mercurial, and Subversion. HTTP API, HTTPs support, webhook handler, scheduled builds, Slack and HipChat integration.
Stars: ✭ 96 (-3.03%)
Mutual labels:  api
Dotweb
Simple and easy go web micro framework
Stars: ✭ 1,354 (+1267.68%)
Mutual labels:  webframework
Bluelinky
An unofficial nodejs API wrapper for Hyundai bluelink
Stars: ✭ 94 (-5.05%)
Mutual labels:  api
Graphql Dotnetcore
GraphQL for .NET core based on https://github.com/graphql/graphql-js
Stars: ✭ 97 (-2.02%)
Mutual labels:  api
Ksql Python
A python wrapper for the KSQL REST API.
Stars: ✭ 98 (-1.01%)
Mutual labels:  api

Build Status Coverage Status badge

Luna

Full Documentation

A web application and API framework in modern C++

A web application and API framework in modern C++, Luna is designed to be easy to use and integrate with any C++ project that needs to serve HTTP endpoints. Luna’s core philosophy is that it should be easy to use correctly and difficult to use incorrectly. Of course, it should be robust as well.

You are writing in C++ (because C++ is awesome), and your app needs to provide a lightweight HTTP server to communicate with other web services. libmicrohttpd is super-awesome, except for that idiomatically C API. Luna is an idiomatically C++ wrapper for libmicrohttpd that leans on modern C++ programming concepts.

HTTP server creation, start, shut down, and deletion are all handled behind the scenes with the magic of RAII. Starting a server is automatic with instantiating a server object, and allowing your server object to fall out of scope is all that is needed to cleanly shut it down. There is nothing else for you to keep track of, or allocate.

Adding endpoints to your server is likewise meant to be simple. Nominate an endpoint with a string or regex and an HTTP verb, and pass in a lambda or other std::functional-compatible object (function pointers, bound class member functions), and return a string containing the desired response body. Of course, you can set headers and mime types, too.

Example code

But don't take my word for it. Here is some code for serving a simple JSON snippet from a single endpoint.

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

using namespace luna;

int main(void)
{
    //start a server delivering JSON by default on the default port 8080
    server server;

    // Handle GET requests to "localhost:8080/endpoint"
    // Respond with a tiny bit of fun JSON
    auto router = server.create_router("/");

    router->set_mime_type("application/json"); //the default is "text/html; charset=utf-8"

    router->handle_request(request_method::GET, "/endpoint",
                          [](auto request) -> response
    {
        return {"{\"made_it\": true}"};
    });

    server.start(); //run forever, basically, or until the server decides to kill itself.
}

Prerequisites

A C++14 capable compiler (tested against gcc 4.9, clang 3.6), CMake 2.8. Conan for installing dependencies.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].