I need to create a web service to convert between different currencies using the scotty web framework in Haskell.
The web service should respond to get requests such as /convert/15?to=usd&from=eur.
I have this code so far:
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Data.Monoid (mconcat)
functionxs :: a -> Int
functionxs a = 5
main = scotty 3000 $ do
get "/:word" $ do
name <- param "word"
html $ mconcat ["<h1>Hi, ", greeting, " what's up!</h1>"]
Thus, when you execute in the browswer: http://localhost:3000/Tony the result is: Hi, Tony, what's up!
The problem is that I don't know how to change the code in order to have '/convert/15?to=usd&from=eur.' as request and get the proper answer.
Hopefully anyone can help me.
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire