mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
48 lines
914 B
C++
48 lines
914 B
C++
#include "rdn_application.h"
|
|
|
|
#include "core/request.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include "core/file_cache.h"
|
|
|
|
void RDNApplication::index(Request *request) {
|
|
std::string body;
|
|
|
|
if (FileCache::get_singleton()->get_cached_body("index", &body)) {
|
|
request->response->setBody(body);
|
|
|
|
return;
|
|
}
|
|
|
|
body = "<html>hello world aaaaa </html>";
|
|
|
|
FileCache::get_singleton()->set_cached_body("index", body);
|
|
|
|
request->response->setBody(body);
|
|
}
|
|
|
|
void RDNApplication::session_middleware_func(Request *request) {
|
|
std::cout << "dddd" << std::endl;
|
|
}
|
|
|
|
void RDNApplication::setup_routes() {
|
|
Application::setup_routes();
|
|
|
|
index_func = index;
|
|
|
|
main_route_map["asd"] = index;
|
|
}
|
|
|
|
void RDNApplication::setup_middleware() {
|
|
Application::setup_middleware();
|
|
|
|
middlewares.push_back(RDNApplication::session_middleware_func);
|
|
}
|
|
|
|
RDNApplication::RDNApplication() :
|
|
Application() {
|
|
}
|
|
|
|
RDNApplication::~RDNApplication() {
|
|
} |