2019-07-12 19:05:56 +00:00
|
|
|
#include <drogon/drogon.h>
|
|
|
|
#include <sqlite3.h>
|
|
|
|
|
|
|
|
#include <models/device_dbo.h>
|
2019-07-19 09:41:39 +00:00
|
|
|
#include <csignal>
|
2019-07-12 19:05:56 +00:00
|
|
|
|
|
|
|
#include "globals.h"
|
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
/*static void test()
|
|
|
|
{
|
|
|
|
LOG_DEBUG << "LOOP";
|
|
|
|
}*/
|
2019-07-12 19:05:56 +00:00
|
|
|
|
2019-07-19 09:41:39 +00:00
|
|
|
int main()
|
|
|
|
{
|
2019-07-12 19:05:56 +00:00
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* Open database */
|
|
|
|
rc = sqlite3_open("test.db", &globals::db);
|
|
|
|
|
|
|
|
if( rc ) {
|
|
|
|
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(globals::db));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Load config file
|
|
|
|
drogon::app().loadConfigFile("../config.json");
|
2019-07-19 09:41:39 +00:00
|
|
|
|
|
|
|
//drogon::app().getLoop()->runEvery(1, &test);
|
|
|
|
|
2019-07-12 19:05:56 +00:00
|
|
|
//Run HTTP framework,the method will block in the internal event loop
|
|
|
|
drogon::app().run();
|
|
|
|
return 0;
|
|
|
|
}
|