mirror of https://github.com/knative/docs.git
serving/helloworld-haskell: respect the port env var (#463)
This commit is contained in:
parent
3935463648
commit
421f44e47a
|
@ -63,9 +63,11 @@ following instructions recreate the source files from this folder.
|
||||||
import Web.Scotty.Trans
|
import Web.Scotty.Trans
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
t <- fromMaybe "World" <$> lookupEnv "TARGET"
|
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 :: String -> ScottyM()
|
||||||
route t = get "/" $ hello t
|
route t = get "/" $ hello t
|
||||||
|
|
|
@ -11,7 +11,9 @@ import Web.Scotty.Trans
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
t <- fromMaybe "World" <$> lookupEnv "TARGET"
|
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 :: String -> ScottyM()
|
||||||
route t = get "/" $ hello t
|
route t = get "/" $ hello t
|
||||||
|
|
Loading…
Reference in New Issue