Image Image Image Image Image
Scroll to Top

To Top

code

09

Mar
2014

No Comments

In code

By admin

Making a tiny web server in Haskell

On 09, Mar 2014 | No Comments | In code | By admin

Recently I have been having fun in my spare time discovering how to implement a tcp server / client in Haskell. It’s incredible easy to implement just a couple of lines of code. Building on top of that, today I learned how to implement an http server. Turns out http is just sending and receiving text (and other content) over tcp. As a nice application, I quickly coded a program that given a port and file path starts a web server which will display a webpage with a link to the file which when clicked sends the file to the client’s browser. This is very handy to quickly transfer a file to a friend over a local network. I was impressed with how little code it was needed to implement this in Haskell, and how high level and elegant that code was.

Tags |

Submit a Comment