Web servers in D

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 25 01:13:09 PDT 2017


On 2017-08-25 07:25, Hasen Judy wrote:
> What libraries are people using to run webservers other than vibe.d?
> 
> Don't get me wrong I like the async-io aspect of vibe.d but I don't like 
> the weird template language and the fact that it caters to mongo crowd.
> 
> I think for D to a have good web story it needs to appeal to serious 
> backend developers, not hipsters who go after fads (mongodb is a fad, 
> jade/haml is a fad).

Why would a backend developer care about front end stuff like jade/haml? 
Just don't use those parts ;)

> I probably need to combine several libraries, but the features I'm 
> looking for are:
> 
> - Spawn an HTTP server listening on a port, and routing requests to 
> functions/delegates, without hiding the details of the http 
> request/response objects (headers, cookies, etc).
> 
> - Support for websockets
> 
> - Runs delegates in fibers/coroutines
> 
> - Basic database connectivity (No "orm" needed; just raw sql).

It depends on which database you need to connect to. For PostgreSQL 
there's ddb [1] and for MySQL there's mysql-native [2].

> - When iterating the result set of a sql query, has the ability to 
> automatically map each row against a struct, and throw if the structure 
> does not match.

I don't know about mysql-native, but for ddb you can use the PGCommand 
class and the executeQuery or executeRow to execute the query and 
specify the struct that should be returned.

> - More generally, map any arbitrary object (such as json) to a struct. 
> Something like Zewo/Reflection package for swift[0].

vibe.d has built-in support for serialization [3].

> [0]: https://github.com/Zewo/Reflection
> 
> I feel like Vibe.d satisfies my first 3 requirements, but for the rest I 
> will probably have to look for something else.

[1] http://code.dlang.org/packages/ddb
[2] http://code.dlang.org/packages/mysql-native
[3] http://vibed.org/api/vibe.data.serialization

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list