Hi All,
Request your help on the below code and error
Error:
source\app.d(25,15): Error: none of the overloads of writeBody
are callable using argument types (VariantN!20LU), candidates are
Code:
import vibe.vibe;
import std.array : array;
import mysql;
import std.stdio;
import std.range;
void main()
{
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["127.0.0.1"];
listenHTTP(settings, &hello);
logInfo("Please open http://127.0.0.1:8080/ in your browser.");
runApplication();
}
void hello(HTTPServerRequest req, HTTPServerResponse res)
{
auto connectionStr =
"host=test.srv.com;port=3910;user=testusr;pwd=xxxx#;db=test";
Connection conn = new Connection(connectionStr);
scope(exit) conn.close();
ResultRange range = conn.query("SELECT host_name FROM
`hosts_coll`");
Row row = range.front;
res.writeBody(row[0]);
}
From,
Vino.B