Erlang – I’m falling in love. a simple web server in erlang is just a few lines.

Ok.   #Erlang  is cool.  It’s not gamer-cool.  It’s nerd-cool.  Check out how easy it is to make a working web server:

1> application:start(inets).
2> inets:start(httpd, [{server_name, “hello”},
{port, 8081},
{server_root, “/tmp”},
{document_root, “/tmp”},
{modules, [mod_get]}]).

Now create a directory like C:\TMP
[in my case, it was E:\TMP]

Put a file in it called “hello.txt”

In your browser, any browser:
http : // localhost:8081/hello.txt.

and it’ll show up.

That’s it.  I can’t believe it’s that simple.

Leave a comment

Your email address will not be published. Required fields are marked *


8 + four =

Leave a Reply