Created static file middleware. Closes #58

Before the static file serving was built in and non configurable
by the user. Now it's a global middleware, fully configurable by
the user and 100% optional. I also made some simple changes with
the way we handle writes on socket to make the code a bit more
resilient.