Vibe.d help
Martin Tschierschke via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 22 02:14:46 PDT 2016
On Thursday, 22 September 2016 at 01:38:12 UTC, Gestalt Theory
wrote:
> 1. I get this error when trying to run a project in VS. dub
> doesn't give the error.
>
> First-chance exception: core.exception.AssertError free()
> called with null array. at
> vibe-d-0.7.26\source\vibe\utils\memory.d(110)
>
> It constantly pops up then I get an access violation and crash.
>
>
> 2. Many vibe.d HTTP Server options seem not to be implemented.
> Is this still the case? e.g.,
> http://vibed.org/api/vibe.http.server/HTTPServerSettings.maxRequestTime
>
> 3. How to serve static files properly?
>
> void images(HTTPServerRequest req, HTTPServerResponse res)
> {
> writeln("images Request");
> write("Path = "); writeln(req.fullURL);
> // Somehow reship request out
> }
>
> ...
>
> router.get("/images/*", &images);
>
>
> I would like to be able to serve them but also log or redirect
> if possible. The messages are written. I tried to also serve
> directly and it didn't work, which is why I used a handler in
> the first place.
>
> router.get("/images/*", serveStaticFiles("images/"));
>
> I imagine the path is not correct. I am on windows and created
> an images sub dir in the projects(same depth as views, etc) but
> the images were not served. I didn't want to hard code this
> path, maybe it should be?
[...]
> 5. Many other frameworks seem to support "hot swapping" of
> files while the sever is running rather than having to
> recompile. Recompiling the diet templates/project is slow and
> requires restarting the server and all that. Is there any way
> to get vibe.d to automatically monitor the projects folder or
> templates for changes and then somehow recompile and update/etc?
>
> Thanks.
Just to point 3. I hope I can give a hint, the problem is, that
the match is not the * but /images/*, so
router.get("/images/*", serveStaticFiles("images/"))
will look in PROJECTHOME/images/images/ for the file.
For my .css files located in
PROJECTHOME/public/styles/
I used:
router.get("/styles/*", serveStaticFiles("public/"))
if you put your images in
PROJECTHOME/public/images
router.get("/images/*", serveStaticFiles("public/"));
should work.
@5. There is a solution, hopefully I can find the link and post
it later.
More information about the Digitalmars-d-learn
mailing list