ipkn/crow — pull request #3 by acron0 (2014-06-02 07:29:30+00:00)
Title: Added middleware framework

NOTE: This is built from `acron:logging`, not `ipkn:master`

Introducing middleware.h:

Adds the ability to inject middleware handlers both pre and post response:

class ExampleMiddlewareHandler : public crow::IMiddlewareHandler {
public:
crow::response handle(const crow::request& req, crow::middleware::context *c) override {
// pre-response
auto result = c->next();
// post-response
return result;
}
};

crow::middleware::use(std::make_shared());

(Macros coming soon!)