daster/source/response.d

16 lines
285 B
D

module response;
import vibe.vibe;
struct Res {
bool error;
string message;
string data;
}
void send(HTTPServerResponse res, bool error = false, string message = "", string data = "") {
res.writeJsonBody(Res(
error, message, data
).serializeToJson());
}