memgraph/speedy/test.cpp

36 lines
721 B
C++
Raw Normal View History

#include <iostream>
#include "speedy.hpp"
// TODO: still doesn't work
// debug the whole thing
void test(http::request_cb_t callback, speedy::Speedy &app) {
app.get("/test", callback);
}
auto foo = [](http::Request& req, http::Response& res) {
res.send("foo");
};
int main(void)
{
2015-09-20 20:30:26 +08:00
uv::UvLoop loop;
http::Ipv4 ip("0.0.0.0", 3400);
2015-09-20 20:30:26 +08:00
speedy::Speedy app(loop, ip);
app.get("/foo", foo);
app.get("/bar", [](http::Request& req, http::Response& res) {
res.send("bar");
});
auto cb = [](http::Request& req, http::Response& res) {
res.send("test");
};
test(http::request_cb_t(cb), app);
app.listen();
2015-09-20 20:30:26 +08:00
loop.run(uv::UvLoop::Mode::Default);
return 0;
}