Skip to content

journal 2020 08 16: Haskell HTTP server setup

Eason Chen edited this page Aug 17, 2020 · 1 revision

Getting the server set up

Nothing major, just using Scotty:

Perhaps the slightly more major thing, and indeed was the first thing I tried, before I even tried Scotty, was a library of Twitter types. I found this library, twitter-types (on Hackage), which seems a bit old, but nonetheless seem to work.

I also have some basic tests set up, and indeed, de-serialisation works.

Gotcha

The Twitter reference docs are showing a syntactically-invalid code-block as their example value for their JSON objects. In this case, it was the example for the Status object (i.e. a tweet) on the reference page for GET statuses/user_timeline:

image

image

Look at how the value part of the JSON expression didn't escape the double-quotes. It caused me a lot of digging around before I found out what was wrong! I thought it was the twitter-types library that was out-of-date. Apparently no evidence for that yet!

Clone this wiki locally