diff --git a/api/source/app.d b/api/source/app.d index 8f7e7a6..359ca82 100644 --- a/api/source/app.d +++ b/api/source/app.d @@ -3,7 +3,7 @@ import handy_http_starter; void main() { Http1TransportConfig transportConfig = defaultConfig(); - transportConfig.port = 8080; + transportConfig.port = 8110; HttpTransport transport = new TaskPoolHttp1Transport(new AppHandler(), transportConfig); transport.start(); } @@ -33,8 +33,11 @@ void getEntries(string partyName, ref ServerHttpResponse response) { import std.file; import std.path; import std.json; - if (!exists("data")) return; const filename = buildPath("data", partyName ~ ".json"); + if (!exists(filename)) { + response.writeBodyString("[]", ContentTypes.APPLICATION_JSON); + return; + } JSONValue root = parseJSON(readText(filename)); response.writeBodyString(root.object["entries"].toJSON(), ContentTypes.APPLICATION_JSON); } diff --git a/app.html b/index.html similarity index 93% rename from app.html rename to index.html index a1c8a8f..2464e25 100644 --- a/app.html +++ b/index.html @@ -2,6 +2,7 @@