Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Ask HN: How would you an API to handle request variability by US state?.
Some other things I would do:
- Simplify API: (/service/${STATE})
- Create a dictionary of ${STATE} to RequestHandler's for all cases, and a default case.
- Divide as much functionality into reusable stateless functions.
- Compose RequestHandler's with reusable functions.
Now when the server receives a request with ${STATE} it can look up the appropriate handler in the dictionary and process the request.
Some other things I would do:
- Simplify API: (/service/${STATE})
- Create a dictionary of ${STATE} to RequestHandler's for all cases, and a default case.
- Divide as much functionality into reusable stateless functions.
- Compose RequestHandler's with reusable functions.
Now when the server receives a request with ${STATE} it can look up the appropriate handler in the dictionary and process the request.