30 lines
627 B
C++
30 lines
627 B
C++
#pragma once
|
|||
|
|
|
||
|
|
// Class-based views, aiohttp style: constructed with the Request, one virtual
|
||
|
|
// coroutine-equivalent per HTTP method, dispatch selects by method.
|
||
|
|
// Gap: real molo::views::View in 05-request-routing.md is coroutine based.
|
||
|
|
|
||
|
|
#include "Http.hpp"
|
||
|
|
|
||
|
|
namespace molo::example::fw {
|
||
|
|
|
||
|
|
class View {
|
||
|
|
public:
|
||
|
|
explicit View(Request req);
|
||
|
|
virtual ~View() = default;
|
||
|
|
|
||
|
|
Response dispatch();
|
||
|
|
|
||
|
|
virtual Response get();
|
||
|
|
virtual Response post();
|
||
|
|
virtual Response put();
|
||
|
|
virtual Response patch();
|
||
|
|
virtual Response del();
|
||
|
|
virtual Response options();
|
||
|
|
|
||
|
|
protected:
|
||
|
|
Request req_;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace molo::example::fw
|