-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 330431a
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist/ | ||
cabal.sandbox.config | ||
.cabal-sandbox |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module App | ||
( api | ||
) where | ||
|
||
import Web.Scotty | ||
import Network.HTTP.Types | ||
|
||
api :: ScottyM () | ||
api = get "/ping" $ do | ||
status status200 | ||
text "back" |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
import Web.Scotty | ||
import App (api) | ||
import Util | ||
|
||
main :: IO () | ||
main = do | ||
port <- getEnvWithDefault "PORT" "3636" | ||
scotty (read port) api | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Util | ||
( getEnvWithDefault | ||
) where | ||
|
||
import Data.Maybe | ||
import System.Environment | ||
|
||
getEnvWithDefault :: String -> String -> IO String | ||
getEnvWithDefault name defaultValue = do | ||
x <- lookupEnv name | ||
return $ fromMaybe defaultValue x |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- Initial wed-is-socket.cabal generated by cabal init. For further | ||
-- documentation, see http://haskell.org/cabal/users-guide/ | ||
|
||
name: wed-is-socket | ||
version: 0.1.0.0 | ||
-- synopsis: | ||
-- description: | ||
-- license: | ||
license-file: LICENSE | ||
author: Nathan Kot | ||
maintainer: me@nathankot.com | ||
-- copyright: | ||
-- category: | ||
build-type: Simple | ||
-- extra-source-files: | ||
cabal-version: >=1.10 | ||
|
||
executable wed-is-socket | ||
main-is: Main.hs | ||
-- other-modules: | ||
-- other-extensions: | ||
build-depends: base >=4.7 && <4.8, | ||
scotty, | ||
websockets, | ||
http-types | ||
-- hs-source-dirs: | ||
default-language: Haskell2010 |