Jump to page: 1 2
Thread overview
HelloWordl in Webserver
Mar 17, 2012
Xan
Mar 17, 2012
Adam D. Ruppe
Mar 17, 2012
Xan
Mar 18, 2012
Kapps
Mar 19, 2012
Xan
Apr 03, 2012
David
Mar 19, 2012
simendsjo
Apr 03, 2012
Xan
Apr 03, 2012
Xan
Apr 03, 2012
Timon Gehr
Apr 03, 2012
Adam D. Ruppe
Apr 03, 2012
Xan
Apr 03, 2012
Xan
Apr 03, 2012
Adam D. Ruppe
Apr 03, 2012
Adam D. Ruppe
Apr 04, 2012
Xan
Apr 04, 2012
Adam D. Ruppe
Apr 04, 2012
Dmitry Olshansky
Mar 18, 2012
dennis luehring
March 17, 2012
I dont' want to battle among languages, but I see that in Golang there is a beatiful solution to display HelloWorld program in web server [rosettacode.org/wiki/Hello_world/Web_server#Go]. I'm convinced there is a D equivalent?

Can someone say what's its aspect?

Thanks in advance,
Xan.
March 17, 2012
On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:
> I'm convinced there is a D equivalent?

It all depends on the library. If you use my code
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff

It looks like this:

==
import arsd.cgi;
void hello(Cgi cgi) {
    cgi.write("Hello, world!");
}
mixin GenericMain!hello;
==


You can build that as a cgi app to drop into any
web server, a FastCGI app to use a longer running
process on almost any webserver, or a HTTP server,
standalone.

Get cgi.d from my github then

dmd hello.d cgi.d # builds cgi version
dmd hello.d cgi.d -version=fastcgi # fastcgi, you also need the Fast CGI C library from the internet (search for libfcgi)

or get netman.d and httpd.d and

dmd hello.d cgi.d netman.d httpd.d -version=embedded_httpd # standalone, only works on linux

March 17, 2012
So, there is not built-in functions?

Thanks,
Xan.

On Saturday, 17 March 2012 at 20:18:39 UTC, Adam D. Ruppe wrote:
> On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:
>> I'm convinced there is a D equivalent?
>
> It all depends on the library. If you use my code
> https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff
>
> It looks like this:
>
> ==
> import arsd.cgi;
> void hello(Cgi cgi) {
>     cgi.write("Hello, world!");
> }
> mixin GenericMain!hello;
> ==
>
>
> You can build that as a cgi app to drop into any
> web server, a FastCGI app to use a longer running
> process on almost any webserver, or a HTTP server,
> standalone.
>
> Get cgi.d from my github then
>
> dmd hello.d cgi.d # builds cgi version
> dmd hello.d cgi.d -version=fastcgi # fastcgi, you also need the Fast CGI C library from the internet (search for libfcgi)
>
> or get netman.d and httpd.d and
>
> dmd hello.d cgi.d netman.d httpd.d -version=embedded_httpd # standalone, only works on linux


March 18, 2012
On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:
> So, there is not built-in functions?
>
> Thanks,
> Xan.
>

There's no built in webserver class, and it's not something that should be in the standard library in the first place.


March 18, 2012
Am 17.03.2012 21:08, schrieb Xan:
> I dont' want to battle among languages,

its maybe only a library battle

> but I see that in Golang
> there is a beatiful solution to display HelloWorld program in web
> server [rosettacode.org/wiki/Hello_world/Web_server#Go].

no its creates and simple webserver and displays your Hello world

> I'm
> convinced there is a D equivalent?

i think you've got only pure stocket library around std.socket or something like that - maybe you find an implementation of an web-server in the tango library

> Can someone say what's its aspect?

???

> Thanks in advance,
> Xan.

March 19, 2012
On Sunday, 18 March 2012 at 05:19:48 UTC, Kapps wrote:
> On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:
>> So, there is not built-in functions?
>>
>> Thanks,
>> Xan.
>>
>
> There's no built in webserver class, and it's not something that should be in the standard library in the first place.

A pain. A planning for that?
March 19, 2012
On Sun, 18 Mar 2012 06:19:47 +0100, Kapps <opantm2+spam@gmail.com> wrote:

> On Saturday, 17 March 2012 at 20:52:33 UTC, Xan wrote:
>> So, there is not built-in functions?
>>
>> Thanks,
>> Xan.
>>
>
> There's no built in webserver class, and it's not something that should be in the standard library in the first place.

I think phobos should include a simple http server for testing purposes.
April 03, 2012
I receive errors:

xan@gerret:~/proves/dlang-proves$ ls
cgi.d  functions.d  httpd.d  netman.d  server.d
xan@gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d
httpd.d:5: Error: module netman is in file 'arsd/netman.d' which cannot be read
import path[0] = /usr/include/d2/4.6/i686-linux-gnu
import path[1] = /usr/include/d2/4.6


What fails?

I use gdmd instead of dmd

On Saturday, 17 March 2012 at 20:18:39 UTC, Adam D. Ruppe wrote:
> On Saturday, 17 March 2012 at 20:08:24 UTC, Xan wrote:
>> I'm convinced there is a D equivalent?
>
> It all depends on the library. If you use my code
> https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff
>
> It looks like this:
>
> ==
> import arsd.cgi;
> void hello(Cgi cgi) {
>     cgi.write("Hello, world!");
> }
> mixin GenericMain!hello;
> ==
>
>
> You can build that as a cgi app to drop into any
> web server, a FastCGI app to use a longer running
> process on almost any webserver, or a HTTP server,
> standalone.
>
> Get cgi.d from my github then
>
> dmd hello.d cgi.d # builds cgi version
> dmd hello.d cgi.d -version=fastcgi # fastcgi, you also need the Fast CGI C library from the internet (search for libfcgi)
>
> or get netman.d and httpd.d and
>
> dmd hello.d cgi.d netman.d httpd.d -version=embedded_httpd # standalone, only works on linux


April 03, 2012
On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote:
> I receive errors:
>
> xan@gerret:~/proves/dlang-proves$ ls
> cgi.d  functions.d  httpd.d  netman.d  server.d
> xan@gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d httpd.d
> httpd.d:5: Error: module netman is in file 'arsd/netman.d' which cannot be read
> import path[0] = /usr/include/d2/4.6/i686-linux-gnu
> import path[1] = /usr/include/d2/4.6
>
>
> What fails?
>
> I use gdmd instead of dmd
>
>

It works when I change arsd.<name> to <name> in import.But I receive several warnings:

$ gdmd-4.6 server.d cgi.d netman.d httpd.d
Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. They will be removed in February 2012. Please use std.datetime instead.
netman.d:428: Error: function std.date.getUTCtime is deprecated


I suspect your code is too elder.


Thanks,
April 03, 2012
On 04/03/2012 10:45 AM, Xan wrote:
> On Tuesday, 3 April 2012 at 08:42:01 UTC, Xan wrote:
>> I receive errors:
>>
>> xan@gerret:~/proves/dlang-proves$ ls
>> cgi.d functions.d httpd.d netman.d server.d
>> xan@gerret:~/proves/dlang-proves$ gdmd-4.6 server.d cgi.d netman.d
>> httpd.d
>> httpd.d:5: Error: module netman is in file 'arsd/netman.d' which
>> cannot be read
>> import path[0] = /usr/include/d2/4.6/i686-linux-gnu
>> import path[1] = /usr/include/d2/4.6
>>
>>
>> What fails?
>>
>> I use gdmd instead of dmd
>>
>>
>
> It works when I change arsd.<name> to <name> in import.But I receive
> several warnings:
>
> $ gdmd-4.6 server.d cgi.d netman.d httpd.d
> Notice: As of Phobos 2.055, std.date and std.dateparse have been
> deprecated. They will be removed in February 2012. Please use
> std.datetime instead.
> netman.d:428: Error: function std.date.getUTCtime is deprecated
>
>
> I suspect your code is too elder.
>
>
> Thanks,

You can just comment out the code there (afaik it is only a custom formatting routine), or compile with the -d flag.
« First   ‹ Prev
1 2