Skip to content

MarkDucommun/server

Repository files navigation

server

This is my second (but first test-driven attempt) at writing an HTTP server in Haskell. It is intended as both an exploration of Haskell and the HTTP protocol and is thus inherently incomplete as my knowledge of both is also incomplete. As I better understand each element, this codebase will continue to improve. I actually haven't read the HTTP/1.1 specification I am presently implementing.

I am writing this by adding thin, vertical slices of atomic functionality. This allows the product to be useful near immediately. At present, I have written two demonstration routes. The first can reach out to the internet via the client that was built in tandem with this server as a testing utility. The second will output the contents of any file on the computer on which it is running. Take care! Both routes will respond to any HTTP verb.

I hope you enjoy reading and modifying this as much as I have enjoyed creating it.


How To Run

  1. Install Stack
  2. Run stack build --ghc-options="-Wall -Werror" inside the project directory
  3. Run stack exec server-exe inside the project directory
  4. Your server is now listening on port 8080.
  5. Add more routes in the main.hs file.

* I'm not certain that I haven't missed something

How To Test

  1. Install Stack
  2. Run stack test

Complete

  1. HTTP Client
    • GET
    • POST
    • PUT
    • DELETE
  2. HTTP Server
    • GET
    • POST
    • PUT
    • DELETE
  3. Headers
    • Client request
    • Client response
    • Server request
    • Server response
  4. JSON writer

Backlog

  1. JSON parser
  2. Lightweight document store

Icebox

  1. HTML templating DSL
  2. Functional dependency injection
  3. Route matching based on passed params or headers
  4. HTTPS

About

A Haskell Webserver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published