2020-11-24 15:41:18 +01:00
|
|
|
#include <iostream>
|
2020-11-25 00:20:41 +01:00
|
|
|
#include <string>
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 13:28:34 +01:00
|
|
|
#include "core/http_server.h"
|
|
|
|
#include "core/application.h"
|
|
|
|
#include "core/file_cache.h"
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
#include "rdn_application.h"
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
#define MAIN_CLASS RDNApplication
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
int main(int argc, char **argv) {
|
2020-11-25 14:53:53 +01:00
|
|
|
FileCache *file_cache = new FileCache(true);
|
2020-11-25 00:20:41 +01:00
|
|
|
file_cache->wwwroot = "./www";
|
2020-11-25 14:53:53 +01:00
|
|
|
file_cache->wwwroot_refresh_cache();
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
Application *app = new MAIN_CLASS();
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
app->setup_routes();
|
2020-11-25 21:00:22 +01:00
|
|
|
app->setup_middleware();
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
HTTPServer *server = new HTTPServer();
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
server->port = 8080;
|
|
|
|
server->initialize();
|
|
|
|
server->main_loop();
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
delete server;
|
|
|
|
delete app;
|
|
|
|
delete file_cache;
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
return 0;
|
|
|
|
}
|