Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heapwolf/route
A simple http router in c++ that can be used with nodeuv-http
https://github.com/heapwolf/route
Last synced: 5 days ago
JSON representation
A simple http router in c++ that can be used with nodeuv-http
- Host: GitHub
- URL: https://github.com/heapwolf/route
- Owner: heapwolf
- License: mit
- Created: 2014-09-03T17:00:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-31T21:09:43.000Z (over 9 years ago)
- Last Synced: 2024-11-01T18:37:30.253Z (12 days ago)
- Language: C++
- Homepage:
- Size: 272 KB
- Stars: 27
- Watchers: 4
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SYNOPSIS
A very simple request router for C++# EXAMPLE
This example uses the [`libuv-http`](https://github.com/hij1nx/libuv-http)
server.```cpp
#include "http.h"
#include "route.h"int main() {
Router router;
Server hs([](auto &req, auto &res) {
auto match = router.set(req.url);
if (match.test("/books/:id") {
res.setStatus(200);
res.setHeader("Content-Type", "text/plain");
res.setHeader("Connection", "keep-alive");res << "You ordered #" << match.get("id") << res.end();
}});
hs.listen("0.0.0.0", 8000);
}
```# INSTALL
```bash
clib install hij1nx/route
```# TEST
```bash
make
```