36 lines
783 B
C++
36 lines
783 B
C++
#include <drogon/drogon.h>
|
|
#include <sqlite3.h>
|
|
|
|
#include <models/device_dbo.h>
|
|
|
|
#include "globals.h"
|
|
|
|
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;
|
|
} else {
|
|
fprintf(stderr, "Opened database successfully\n");
|
|
}
|
|
|
|
device_dbo test;
|
|
strcpy(test.id, "meine-tolle_id-123");
|
|
strcpy(test.name, "test_device latest name");
|
|
strcpy(test.ip, "192.168.1.68");
|
|
test.active = true;
|
|
|
|
test.save();
|
|
|
|
|
|
//Load config file
|
|
drogon::app().loadConfigFile("../config.json");
|
|
//Run HTTP framework,the method will block in the internal event loop
|
|
drogon::app().run();
|
|
return 0;
|
|
}
|