instruments route

master
Matt Huntington 1 year ago
parent 306c347928
commit fc055b93be

@ -91,6 +91,24 @@ int main()
return entries; return entries;
}); });
CROW_ROUTE(app, "/instruments")([](){
connect();
crow::json::wvalue entries;
ResultSet *res = stmt->executeQuery("SELECT * FROM instruments");
int i = 0;
while (res->next()) {
int id = res->getInt("id");
string instrument = res->getString("name");
entries[i] = {{"id", id}, {"instrument", instrument}};
i++;
}
delete res;
return entries;
});
CROW_ROUTE(app, "/categories")([](){ CROW_ROUTE(app, "/categories")([](){
connect(); connect();
crow::json::wvalue entries; crow::json::wvalue entries;

Loading…
Cancel
Save