An open API service indexing awesome lists of open source software.

https://github.com/avakar/libhttp


https://github.com/avakar/libhttp

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# libhttp

A simple HTTP server implementation.

## Installation

The best way to use libhttp is to use [Crater][1] to manage dependencies and add the following to your DEPS file.

dependencies:
libhttp:
type: 'git'
repo: 'https://github.com/avakar/libhttp.git'

Then upgrade your dependencies.

$ crater upgrade

Then, in your CMakeLists.txt, include the locally generated cmake file and link to libhttp.

include(deps.cmake)

# ...

target_link_libraries(my_app libhttp)

## Getting started

The simplest server is this one:

#include
#include

response webapp(request const & req)
{
return 404;
}

int main()
{
tcp_listen(80, [](istream & in, ostream & out) {
http_server(in, out, webapp);
});
}

You can figure out the rest, or look at [this project][2] for inspiration.

[1]: https://github.com/avakar/crater
[2]: https://github.com/avakar/agent_maybe