https://github.com/avakar/libhttp
https://github.com/avakar/libhttp
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/avakar/libhttp
- Owner: avakar
- License: other
- Created: 2017-03-05T20:57:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T14:31:37.000Z (about 8 years ago)
- Last Synced: 2025-04-12T19:57:43.854Z (about 2 months ago)
- Language: C++
- Size: 31.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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