{-# LANGUAGE TypeApplications #-} -- | Just to generate javascript functions so I won't have too much -- bother with it module Main where import Universum import Servant.JS import Servant.JS.Vanilla import System.Environment (getArgs) import API apiJS :: Text -> Text apiJS url = jsForAPI (Proxy @API) (vanillaJSWith options) where options = defCommonGeneratorOptions { urlPrefix = url } main :: IO () main = do args <- getArgs case args of [] -> putText (apiJS "") [prefix] -> putText (apiJS (toText prefix)) _ -> error "don't understand these options"