digitalmars.D.learn - Web servers in D
- Hasen Judy (24/24) Aug 24 2017 What libraries are people using to run webservers other than
- Eugene Wissner (13/37) Aug 24 2017 There is collie [1]. Never used. Can't say a lot about it.
- Hasen Judy (6/18) Aug 25 2017 Thanks. Those are some interesting links.
- Jacob Carlborg (14/43) Aug 25 2017 Why would a backend developer care about front end stuff like jade/haml?...
- Andrew Chapman (44/77) Sep 02 2017 Vibe.d does this - just don't use the automatic API generation
- Seb (4/14) Sep 02 2017 There is built-in support for authentication in vibe.d:
- Hasen Judy (5/14) Sep 11 2017 Thanks for your response. I didn't see the new replies because I
- bauss (6/30) Sep 02 2017 Here is another template engine that can be used along with vibe.
- bauss (3/10) Sep 02 2017 To add onto this you can use mysql-native with vibe.d.
- aberba (8/32) Sep 12 2017 In 2017, backend developers are more likely to write
- Hasen Judy (10/53) Nov 28 2017 Sorry this is an incredibly late response.
- rikki cattermole (4/60) Nov 28 2017 Containers are an "easy" way to push your full system over to another's
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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.
Aug 24 2017
On Friday, 25 August 2017 at 05:25:09 UTC, 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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.There is collie [1]. Never used. Can't say a lot about it. arsd [2] has a lot of interesting web stuff: event loop, FastCGI/SimpleCGI; web-, DOM-, mail-utilities. And the last but not least I'm running currently a small web server serving static files based on tanya [3]. Once I'm ready to write a web-framework on top of it, it would be what you mention: no compile-time templates, no jade-style templates, since I dislike these too. But unfortunately it is not something can be used now. [1] https://github.com/huntlabs/collie [2] https://github.com/adamdruppe/arsd [3] https://github.com/caraus-ecms/tanya
Aug 24 2017
On Friday, 25 August 2017 at 06:15:35 UTC, Eugene Wissner wrote:There is collie [1]. Never used. Can't say a lot about it. arsd [2] has a lot of interesting web stuff: event loop, FastCGI/SimpleCGI; web-, DOM-, mail-utilities. And the last but not least I'm running currently a small web server serving static files based on tanya [3]. Once I'm ready to write a web-framework on top of it, it would be what you mention: no compile-time templates, no jade-style templates, since I dislike these too. But unfortunately it is not something can be used now. [1] https://github.com/huntlabs/collie [2] https://github.com/adamdruppe/arsd [3] https://github.com/caraus-ecms/tanyaThanks. Those are some interesting links. FWIW I kind of like compile-time templates. I just don't like jade (or coffee-script, or stylus, or all these languages that try to remove the punctuation and curly braces, and all signs of structure).
Aug 25 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
Aug 25 2017
On Friday, 25 August 2017 at 05:25:09 UTC, 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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.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.Don't use these components :-)- 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).Vibe.d does this - just don't use the automatic API generation feature if you don't like it. Note, you can get access to the request/response objects even if you do use the API generation by using an before method. E.g. in an interface you may have something like this: method(HTTPMethod.POST) before!getRequestInfo("requestInfo") property Token login(LoginRequestMeta login, RequestInfo requestInfo); And then define your getRequestInfo method like this: static RequestInfo getRequestInfo(HTTPServerRequest req, HTTPServerResponse res) { RequestInfo requestInfo; requestInfo.headers = req.headers; requestInfo.ipAddress = req.clientAddress.toAddressString(); requestInfo.userAgent = requestInfo.headers.get("User-Agent", ""); return requestInfo; } In this case I've grabbed the ip address and user agent of the user, but you could also grab cookies etc.- 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.You can do this with MySQL Native whilst using vibe.d. You might do something like this: Prepared prepared = prepare(this.conn, sql); prepared.setArgs(params); auto row = prepared.queryRow(); if (row.isNull()) { throw new Exception("Query returned an empty row"); } T item; try { row.toStruct!T(item); } catch(Exception e) { } Where T is your struct type that you're trying to convert the row to. As for the template language, you could try: http://code.dlang.org/packages/diamond https://github.com/repeatedly/mustache-d There are probably others.
Sep 02 2017
On Saturday, 2 September 2017 at 09:26:27 UTC, Andrew Chapman wrote:On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote:There is built-in support for authentication in vibe.d: https://github.com/rejectedsoftware/vibe.d/tree/master/examples/web-auth[...][...]Don't use these components :-)[...]Vibe.d does this - just don't use the automatic API generation feature if you don't like it. Note, you can get access to the request/response objects even if you do use the API generation by using an before method. E.g. in an interface you may have something like this:
Sep 02 2017
On Saturday, 2 September 2017 at 09:26:27 UTC, Andrew Chapman wrote:Thanks for your response. I didn't see the new replies because I wrote the original message before I signed up on the site forum (I'm using the site, not an email program).[...]Don't use these components :-)[...]Vibe.d does this - just don't use the automatic API generation feature if you don't like it. Note, you can get access to the request/response objects even if you do use the API generation by using an before method. E.g. in an interface you may have something like this: [...]
Sep 11 2017
On Friday, 25 August 2017 at 05:25:09 UTC, 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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.Here is another template engine that can be used along with vibe. I actually made it for the same reason you don't wanna use vibe. Because I didn't like the template language and I was more familiar with razor templates from ASP.NET https://github.com/bausshf/Diamond
Sep 02 2017
On Saturday, 2 September 2017 at 20:18:17 UTC, bauss wrote:On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote:To add onto this you can use mysql-native with vibe.d. https://github.com/mysql-d/mysql-native[...]Here is another template engine that can be used along with vibe. I actually made it for the same reason you don't wanna use vibe. Because I didn't like the template language and I was more familiar with razor templates from ASP.NET https://github.com/bausshf/Diamond
Sep 02 2017
On Friday, 25 August 2017 at 05:25:09 UTC, 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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.In 2017, backend developers are more likely to write microservices which expose rest/graphQL APIs and put them in dockers containers.... Unless you're a full stack developer, you'll not be using jade/diet (at least not enough to be tempted to use something else). Its still sucks there's no object storage api for D. Are you guys still building monolithic web servers?
Sep 12 2017
On Tuesday, 12 September 2017 at 12:34:26 UTC, aberba wrote:On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote:Sorry this is an incredibly late response. Come on now, in CURRENT_YEAR people are jumping and this year's fad train. I don't want to jump along, thank you very much. And I don't understand this containers business. As far as I can tell it was designed for interpreted languages because they tend to have a lot of very specific dependences that are a hell to manage. If the compiler can produce a statically linked binary, then there's no problem that a container would solve here.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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.In 2017, backend developers are more likely to write microservices which expose rest/graphQL APIs and put them in dockers containers.... Unless you're a full stack developer, you'll not be using jade/diet (at least not enough to be tempted to use something else). Its still sucks there's no object storage api for D. Are you guys still building monolithic web servers?
Nov 28 2017
On 29/11/2017 5:51 AM, Hasen Judy wrote:On Tuesday, 12 September 2017 at 12:34:26 UTC, aberba wrote:Containers are an "easy" way to push your full system over to another's servers. It is all about cost. They are cheaper than VM's as they require less resources to manage and use.On Friday, 25 August 2017 at 05:25:09 UTC, Hasen Judy wrote:Sorry this is an incredibly late response. Come on now, in CURRENT_YEAR people are jumping and this year's fad train. I don't want to jump along, thank you very much. And I don't understand this containers business. As far as I can tell it was designed for interpreted languages because they tend to have a lot of very specific dependences that are a hell to manage. If the compiler can produce a statically linked binary, then there's no problem that a container would solve here.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). 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). - 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. - More generally, map any arbitrary object (such as json) to a struct. Something like Zewo/Reflection package for swift[0]. [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.In 2017, backend developers are more likely to write microservices which expose rest/graphQL APIs and put them in dockers containers.... Unless you're a full stack developer, you'll not be using jade/diet (at least not enough to be tempted to use something else). Its still sucks there's no object storage api for D. Are you guys still building monolithic web servers?
Nov 28 2017