Created
September 25, 2017 15:42
-
-
Save CarstenKoenig/dc342e424178ffe3b9783f54b47d8d74 to your computer and use it in GitHub Desktop.
Demonstration of getting a scotty server running as a script - needs stack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
-- stack --resolver lts-9.5 script --package scotty | |
{-# LANGUAGE OverloadedStrings #-} | |
import Web.Scotty | |
import Data.Monoid (mconcat) | |
main = scotty 3000 $ do | |
get "/:word" $ do | |
beam <- param "word" | |
html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
make sure you have stack installed
after you just have to
and then you can run it using
beware: the first start might take some time (getting/compiling the dependencies) - after it should be much quicker
you can visit the demo site just by browsing to http://localhost:3000
Disclaimer: that's 100% code from the Scotty documentation plus the Stack docs - I only copy&pasted ;)