Sinatra Horoscope Fortune

  • Write a very simple Sinatra Horoscope app
    • Implements a server that gives fortunes. The idea is that the server has a way to generate a fortune on command (like a horoscope) and returns it as data for someone else to incorporate in their application. So your server accepts a URL and returns a fortune. Here are the patterns:
      • /fortunes/:n should return fortune #n
      • /fortunes/random should return a random fortune
      • /fortunes/ should returnn a list of all the fortunes
    • What does the server return? NOT HTML!
      • The server returns “data” in the form of JSON. JSON is a textual representation of hierarchical data designed specifically for this purpose. You have already used it in previous homeworks.
      • In Ruby, any Hash can be turned into JSON by doing .to_json
    • Where do the fortunes come from? You need to have some kind of database. That database could be on disk (i.e. using Mysql or Sqllite) or you could just represnet them in an array: ```FORTUNES = [“You will win the lottery”, “You will make an important discovery”, “You will loose your mind”]
    • Feel free to add features to make it more interesting!
    • Deliverable: A brief screencast demonstrating that your code works. (see Screencast )