Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions serving/samples/helloworld-haskell/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Hello World - Haskell sample

A simple web app written in Haskell that you can use for testing.
It reads in an env variable `TARGET` and prints "Hello World: ${TARGET}!". If
TARGET is not specified, it will use "NOT SPECIFIED" as the TARGET.
It reads in an env variable `TARGET` and prints "Hello ${TARGET}!". If
TARGET is not specified, it will use "World" as the TARGET.

## Prerequisites

Expand Down Expand Up @@ -63,9 +63,11 @@ following instructions recreate the source files from this folder.
import Web.Scotty.Trans

main :: IO ()
main = do
t <- fromMaybe "World" <$> lookupEnv "TARGET"
scotty 8080 (route t)
main = do
t <- fromMaybe "World" <$> lookupEnv "TARGET"
pStr <- fromMaybe "8080" <$> lookupEnv "PORT"
let p = read pStr :: Int
scotty p (route t)

route :: String -> ScottyM()
route t = get "/" $ hello t
Expand Down
4 changes: 3 additions & 1 deletion serving/samples/helloworld-haskell/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import Web.Scotty.Trans
main :: IO ()
main = do
t <- fromMaybe "World" <$> lookupEnv "TARGET"
scotty 8080 (route t)
pStr <- fromMaybe "8080" <$> lookupEnv "PORT"
let p = read pStr :: Int
scotty p (route t)

route :: String -> ScottyM()
route t = get "/" $ hello t
Expand Down