2021-11-21 14:41:40 +01:00
|
|
|
#ifndef WP_APPLICATION_H
|
|
|
|
#define WP_APPLICATION_H
|
|
|
|
|
|
|
|
//#include "core/http/web_application.h"
|
|
|
|
#include "core/object.h"
|
2021-11-21 14:50:03 +01:00
|
|
|
#include "core/string.h"
|
2021-11-21 15:18:42 +01:00
|
|
|
#include "modules/drogon/web_application.h"
|
2021-11-21 14:41:40 +01:00
|
|
|
|
|
|
|
#undef LOG_TRACE
|
|
|
|
#undef LOG_WARN
|
|
|
|
|
|
|
|
class WPApplication : public DWebApplication {
|
|
|
|
RCPP_OBJECT(WPApplication, DWebApplication);
|
|
|
|
|
|
|
|
public:
|
2021-11-21 15:18:42 +01:00
|
|
|
static void index_fun(Object *instance, Request *request);
|
|
|
|
static void blog_fun(Object *instance, Request *request);
|
|
|
|
|
|
|
|
void index(Request *request);
|
|
|
|
void blog(Request *request);
|
2021-11-21 14:41:40 +01:00
|
|
|
|
|
|
|
static void routing_middleware(Object *instance, Request *request);
|
|
|
|
|
|
|
|
virtual void setup_routes();
|
|
|
|
virtual void setup_middleware();
|
|
|
|
|
|
|
|
virtual void migrate();
|
|
|
|
|
2021-11-21 15:18:42 +01:00
|
|
|
void add_blog(const String &name, Database *db);
|
|
|
|
|
2021-11-21 14:41:40 +01:00
|
|
|
void compile_menu();
|
|
|
|
|
|
|
|
WPApplication();
|
|
|
|
~WPApplication();
|
|
|
|
|
2021-11-21 14:50:03 +01:00
|
|
|
HandlerInstance blog_func;
|
|
|
|
|
|
|
|
String header;
|
|
|
|
String footer;
|
2021-11-21 15:18:42 +01:00
|
|
|
|
|
|
|
struct BlogData {
|
|
|
|
String name;
|
|
|
|
Database *db;
|
|
|
|
};
|
|
|
|
|
|
|
|
Vector<BlogData> _blog_data;
|
2021-11-21 14:41:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|