createApp :: TernaryTree Char -> Application
createApp tree = application
  where application req = return $ case pathInfo req of
          (_:word:[]) -> responseLBS status200 [("Content-Type", "application/json")]
                         (Aeson.encode . prefixTerms tree $ T.unpack word)
          _ -> notFound
createApp :: TernaryTree Char -> Application
createApp tree = application
  where application req = return $ case pathInfo req of
          (_:word:[]) -> responseLBS status200 [("Content-Type", "application/json")]
                         (Aeson.encode . prefixTerms tree $ T.unpack word)
          _ -> notFound
createApp tree = application
  where application req = return $ case pathInfo req of
          (_:word:[]) -> responseLBS status200 [("Content-Type", "application/json")]
                         (Aeson.encode . prefixTerms tree $ T.unpack word)
          _ -> notFound