vibe.d Subdirectory?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 14 04:24:59 PST 2015


On Wed, 14 Jan 2015 11:40:25 +0000
seany via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> I am new to vibe.d and plying a bit with it.
> 
> I notice, that in case of Apache, there is a "root" directory, 
> often by default under /var/www or /srv/http (resp. ftp) if you 
> are using linux, and then every time the client sends a request, 
> apache looks in to the root directory, deduces the subdirectory 
> from the URI, and pulls the page up from there. Then it parses 
> the PHP / other scripting commands, and prints the HTML as is, 
> before serving it over http.
> 
> I want to know the equivalent of all these in vibe.d. The website 
> has a documentation, but all what I find is that you will need an 
> app.d, in a predefined directory structure. I however, do not 
> understand, what the root directory is going to be.
> 
> Is it going to be the directry where vibe.d is started?
> 
> Say, I start my vibe.d under /server, then I have an app.d under 
> /server/a/app.d and /server/b/app.d
> 
> Do I access them via http://top.level.domain/a, resp /b, and 
> app.d is like index.html / index.php which vibe.d looks for by 
> default, or do i have to use http://top.level.domain/a/app.d

thing about vibe.d as "node.js made right". it's not a ready-to-go
webserver, it's more like an async i/o framework that can be used to
build any server you want.

so you have to write your own dispatcher (it's actually very easy for
easy cases, just consult vibe.d documentation) to get the things you
want. that dispatcher can provide pages from disk, from some db, build
them on the fly and so on. it's up to you how it will work.

yes, this is more complicated than just setting up ready-to-work
webserver, but... but why you want your own simple web-server anyway?
just use one of the already written ones. and if you want some special
processing which you done with some scripting language like PHP for
"traditional setup", vibe.d starts shining: just forgot about that
crappy scripting stuff and write your code in D!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150114/b2a5c17e/attachment.sig>


More information about the Digitalmars-d-learn mailing list