The app is just a test echo server. JSON sent in the body of a POST request is echoed back to the client. On Pop!_OS it works fine but on Windows it responds, there's a delay of about 10 seconds and then it crashes with the error:

```
Error Program exited with code -1073741819
```

Here's the code:
```d
import vibe.vibe;
import std.json, std.stdio;

void main() {
        auto settings = new HTTPServerSettings;
        settings.port = 8080;
        settings.bindAddresses = ["::1", "127.0.0.1"];

    auto router = new URLRouter;
    router.get("*", serveStaticFiles("public/"));
    router.post("/", &onPost);

        auto listener = listenHTTP(settings, router);
        scope (exit) { listener.stopListening(); }

        logInfo("App listening at http://127.0.0.1:8080/";);
        runApplication();
}

static string handlePost(string req) {
    return req;
}

void onPost(HTTPServerRequest req, HTTPServerResponse res) {
    try {
auto jsr = async(&handlePost, req.json.toString()).getResult();
        res.contentType("application/json; charset=utf-8");
        res.writeBody(jsr);
    } catch (Exception e) {
        res.contentType("text/plain; charset=utf-8");
        res.writeBody(e.msg);
    }
}
```

Also when you launch/build the app with dub there's a shed load of deprecation warnings, e.g.:
```
\Local\dub\packages\vibe-d-0.9.5\vibe-d\stream\vibe\stream\wrapper.d(334,23): 
Deprecation: reference to local variable `this` assigned to non-scope parameter 
`bytes` calling `writeToStream`
```

I'm a D newbie so it's quite possibly something I'm doing wrong ...

Reply via email to