#include <drogon/drogon.h>
#include <sqlite3.h>

#include <models/device_dbo.h>
#include <csignal>

#include "globals.h"

/*static void test()
{
    LOG_DEBUG << "LOOP";
}*/

int main()
{
    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");

    //drogon::app().getLoop()->runEvery(1, &test);

    //Run HTTP framework,the method will block in the internal event loop
    drogon::app().run();
    return 0;
}