You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please improve the performance of the C++ application using the Dragon framework. For the second test, add a PostgreSQL database. In the second test, the application should parse the JSON request body, save it to the PostgreSQL database, and return the entire object back to the client, including the database-generated ID.
HTTP/1.1 201 Created
Server: gnet
Date: Thu, 13 Feb 2025 01:23:00 GMT
Content-Length: 57
Content-Type: application/json
{"id":66009,"mac":"81-6E-79-DA-5A-B2","firmware":"4.0.2"}
DB Schema/migration*
---- Create application users.--CREATEUSERcpp WITH PASSWORD 'devops123' SUPERUSER CREATEDB CREATEROLE LOGIN;
CREATEUSERrust WITH PASSWORD 'devops123' SUPERUSER CREATEDB CREATEROLE LOGIN;
---- Clean up idle connections.--
WITH inactive_connections AS (SELECT pid, usename FROM pg_stat_activity WHERE usename ='cpp') SELECT pg_terminate_backend(pid) FROM inactive_connections;
WITH inactive_connections AS (SELECT pid, usename FROM pg_stat_activity WHERE usename ='rust') SELECT pg_terminate_backend(pid) FROM inactive_connections;
BEGIN;
---- Drop tables.--DROPTABLE IF EXISTS cpp_device;
DROPTABLE IF EXISTS rust_device;
---- Create device tables.--CREATETABLE "cpp_device" ("id"SERIALPRIMARY KEY, "mac"varchar(17) NOT NULL, "firmware"varchar(10) NOT NULL);
CREATETABLE "rust_device" ("id"SERIALPRIMARY KEY, "mac"varchar(17) NOT NULL, "firmware"varchar(10) NOT NULL);
COMMIT;
VACUUM full;
Please improve the performance of the C++ application using the Dragon framework. For the second test, add a PostgreSQL database. In the second test, the application should parse the JSON request body, save it to the PostgreSQL database, and return the entire object back to the client, including the database-generated ID.
C++ app - https://github.com/antonputra/tutorials/tree/main/lessons/245/drogon-app
curl -i http://localhost:8080/api/devices
curl -i http://localhost:8080/api/devices -d '{"mac": "81-6E-79-DA-5A-B2", "firmware": "4.0.2"}' -H "Content-Type: application/json"
DB Schema/migration*
Compose for testing
The text was updated successfully, but these errors were encountered: