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/application.h"
|
|
|
|
#include "core/file_cache.h"
|
2020-11-28 14:52:46 +01:00
|
|
|
#include "core/http_server.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-12-01 13:47:02 +01:00
|
|
|
#include "modules/message_page/message_page.h"
|
|
|
|
|
2020-12-01 14:53:32 +01:00
|
|
|
#include "core/database_manager.h"
|
|
|
|
|
|
|
|
#if MYSQL_PRESENT
|
2020-12-01 14:56:05 +01:00
|
|
|
#include "database/mysql/mysql_database.h"
|
2020-12-01 14:53:32 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if PGSQL_PRESENT
|
2020-12-01 14:56:05 +01:00
|
|
|
#include "database/postgres/pgsql_database.h"
|
2020-12-01 14:53:32 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SQLITE_PRESENT
|
2020-12-01 14:56:05 +01:00
|
|
|
#include "database/sqlite/sqlite3_database.h"
|
2020-12-01 14:53:32 +01:00
|
|
|
#endif
|
2020-12-01 14:47:24 +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-24 15:41:18 +01:00
|
|
|
|
2020-11-28 14:52:46 +01:00
|
|
|
#if MYSQL_PRESENT
|
|
|
|
printf("mysql present\n");
|
2020-12-01 14:56:05 +01:00
|
|
|
MysqlDatabase::_register();
|
2020-11-28 14:52:46 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if PGSQL_PRESENT
|
|
|
|
printf("pgsql present\n");
|
2020-12-01 14:56:05 +01:00
|
|
|
PGSQLDatabase::_register();
|
2020-11-28 14:52:46 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SQLITE_PRESENT
|
|
|
|
printf("sqlite present\n");
|
2020-12-01 14:56:05 +01:00
|
|
|
SQLite3Database::_register();
|
2020-11-28 14:52:46 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
FileCache *file_cache = new FileCache(true);
|
|
|
|
file_cache->wwwroot = "./www";
|
|
|
|
file_cache->wwwroot_refresh_cache();
|
|
|
|
|
2020-12-01 14:47:24 +01:00
|
|
|
DatabaseManager *dbm = new DatabaseManager();
|
|
|
|
//dbm->create_database("mysql");
|
|
|
|
|
2020-11-28 14:52:46 +01:00
|
|
|
Application *app = new MAIN_CLASS();
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-28 14:52:46 +01:00
|
|
|
app->setup_routes();
|
|
|
|
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-12-01 13:47:02 +01:00
|
|
|
MessagePage *mp = new MessagePage();
|
|
|
|
|
|
|
|
printf("%s\n", mp->get_class().c_str());
|
|
|
|
|
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;
|
2020-11-28 14:52:46 +01:00
|
|
|
delete app;
|
2020-12-01 14:47:24 +01:00
|
|
|
delete dbm;
|
2020-11-28 14:52:46 +01:00
|
|
|
delete file_cache;
|
2020-12-01 13:47:02 +01:00
|
|
|
delete mp;
|
2020-12-01 14:47:24 +01:00
|
|
|
|
2020-11-24 15:41:18 +01:00
|
|
|
|
2020-11-25 00:20:41 +01:00
|
|
|
return 0;
|
|
|
|
}
|