www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is there an embeddable HTTP server in D?

reply Arun Chandrasekaran <aruncpp0 gmail.com> writes:
In C++ land, I've used cpp-netlib[0] to create a HTTP server. Is 
there a similar library in D?

cpp-netlib uses Boost ASIO and it supports synchronous and 
asynchronous HTTP servers. It also support HTTP client API (which 
I've not used).

Arun

[0] http://cpp-netlib.org/0.11.2/index.html
Jun 29 2016
next sibling parent Dicebot <public dicebot.lv> writes:
On Wednesday, 29 June 2016 at 20:39:45 UTC, Arun Chandrasekaran 
wrote:
 In C++ land, I've used cpp-netlib[0] to create a HTTP server. 
 Is there a similar library in D?

 cpp-netlib uses Boost ASIO and it supports synchronous and 
 asynchronous HTTP servers. It also support HTTP client API 
 (which I've not used).

 Arun

 [0] http://cpp-netlib.org/0.11.2/index.html
http://vibed.org
Jun 29 2016
prev sibling parent reply ketmar <ketmar ketmar.no-ip.org> writes:
Adam's cgi.d from arsd repo[1] contains built-in server 
implementation too, it as one of the available options.


[1] https://github.com/adamdruppe/arsd
Jun 29 2016
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Thursday, 30 June 2016 at 00:10:54 UTC, ketmar wrote:
 Adam's cgi.d from arsd repo[1] contains built-in server 
 implementation too, it as one of the available options.
Indeed. To use this, download cgi.d: https://raw.githubusercontent.com/adamdruppe/arsd/master/cgi.d then make a program like: import arsd.cgi; void hello(Cgi cgi) { cgi.write("Hello!"); } mixin GenericMain!hello; and compile: dmd yourfile.d cgi.d -version=embedded_httpd And you can run the program `yourfile` and it listens on port 8085 by default, or change it at runtime like `./yourfile --port 5000` then go to `http://localhost:5000/` in your browser.
Jun 29 2016