Skip to content

Commit

Permalink
Bump nixpkgs and update handlers (#22)
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <mail@saschagrunert.de>
  • Loading branch information
saschagrunert committed Jun 22, 2019
1 parent 63da624 commit 64bc929
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 27 deletions.
3 changes: 2 additions & 1 deletion config/routes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/ HomeR GET
/api ApiR GET POST
/client ClientR POST
/favicon.ico FaviconR GET
/github GitHubR POST
/static StaticR Static appStatic
30 changes: 16 additions & 14 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{ mkDerivation, aeson, ansi-terminal, base, bytestring
, case-insensitive, classy-prelude, classy-prelude-conduit
, classy-prelude-yesod, conduit, containers, data-default
, directory, fast-logger, file-embed, foreign-store, hjsmin, hpack
, hslogger, http-client, http-client-tls, http-conduit, lens
, megaparsec, monad-control, monad-logger, optparse-applicative
, persistent, persistent-sqlite, persistent-template, safe
, shakespeare, stdenv, tasty, tasty-hspec, tasty-quickcheck
, template-haskell, temporary, text, time, unordered-containers
, uuid, vector, wai, wai-extra, wai-logger, warp, yaml, yesod
, yesod-auth, yesod-core, yesod-form, yesod-static, yesod-test
, directory, fast-logger, file-embed, foreign-store
, github-webhooks, hjsmin, hpack, hslogger, http-client
, http-client-tls, http-conduit, lens, megaparsec, monad-control
, monad-logger, optparse-applicative, persistent, persistent-sqlite
, persistent-template, safe, shakespeare, stdenv, tasty
, tasty-hspec, tasty-quickcheck, template-haskell, temporary, text
, time, unordered-containers, uuid, vector, wai, wai-extra
, wai-logger, warp, yaml, yesod, yesod-auth, yesod-core, yesod-form
, yesod-static, yesod-test
}:
mkDerivation {
pname = "performabot";
Expand All @@ -19,12 +20,13 @@ mkDerivation {
libraryHaskellDepends = [
aeson ansi-terminal base bytestring case-insensitive classy-prelude
classy-prelude-conduit classy-prelude-yesod conduit containers
data-default directory fast-logger file-embed foreign-store hjsmin
hslogger http-client http-client-tls http-conduit lens megaparsec
monad-control monad-logger persistent persistent-sqlite
persistent-template safe shakespeare template-haskell temporary
text time unordered-containers uuid vector wai wai-extra wai-logger
warp yaml yesod yesod-auth yesod-core yesod-form yesod-static
data-default directory fast-logger file-embed foreign-store
github-webhooks hjsmin hslogger http-client http-client-tls
http-conduit lens megaparsec monad-control monad-logger persistent
persistent-sqlite persistent-template safe shakespeare
template-haskell temporary text time unordered-containers uuid
vector wai wai-extra wai-logger warp yaml yesod yesod-auth
yesod-core yesod-form yesod-static
];
libraryToolDepends = [ hpack ];
executableHaskellDepends = [
Expand Down
1 change: 1 addition & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ library:
- fast-logger
- file-embed
- foreign-store
- github-webhooks
- hjsmin
- hslogger
- http-client
Expand Down
6 changes: 4 additions & 2 deletions performabot.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 38eac125c0d21f366d8c3dabe54aaaee9b298efc0badf2725f54a765d580e700
-- hash: 6c821a95966b6f7c260cfb55f5f1f46fbfbcde307733c7d1044ba2e3cb100f88

name: performabot
version: 0.1.0
Expand Down Expand Up @@ -42,8 +42,9 @@ library
exposed-modules:
Env
Foundation
Handler.Api
Handler.Client
Handler.Common
Handler.GitHub
Handler.Home
Import
Import.NoFoundation
Expand Down Expand Up @@ -77,6 +78,7 @@ library
, fast-logger
, file-embed
, foreign-store
, github-webhooks
, hjsmin
, hslogger
, http-client
Expand Down
11 changes: 4 additions & 7 deletions src/Handler/Api.hs → src/Handler/Client.hs
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{-# LANGUAGE NoImplicitPrelude #-}

-- | Main API handler
-- | Client API handler
--
-- @since 0.1.0
module Handler.Api ( getApiR, postApiR ) where
module Handler.Client ( postClientR ) where

import Data.Aeson.Types as T ( Result(Success) )
import Data.Time.Clock ( getCurrentTime )

import Import

getApiR :: Handler Value
getApiR = return $ String "Hello world"

postApiR :: Handler ()
postApiR = do
postClientR :: Handler ()
postClientR = do
body <- parseCheckJsonBody :: Handler (T.Result ReqBody)
case body of
Success (e, b) -> do
Expand Down
11 changes: 11 additions & 0 deletions src/Handler/GitHub.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{-# LANGUAGE NoImplicitPrelude #-}

-- | GitHub API handler
--
-- @since 0.1.0
module Handler.GitHub ( postGitHubR ) where

import Import

postGitHubR :: Handler ()
postGitHubR = sendResponseStatus status200 ()
3 changes: 2 additions & 1 deletion src/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import Database.Persist.Sqlite
import Foundation
( App(..), Route(..), resourcesApp )

import Handler.Api ( getApiR, postApiR )
import Handler.Client ( postClientR )
import Handler.Common ( getFaviconR )
import Handler.GitHub ( postGitHubR )
import Handler.Home ( getHomeR )

import Language.Haskell.TH.Syntax ( qLocation )
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/client/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ verbosity = priority . length
apiUrl :: Parser String
apiUrl = strOption (long "url" <> short 'u' <> help "API url for sending data"
<> metavar "URL" <> showDefault
<> value "http://localhost:3000/api")
<> value "https://performabot.saschagrunert.de/client")

devel :: Parser Bool
devel = switch (internal <> long "devel" <> short 'd')
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ nix:
enable: true
pure: true
shell-file: nix/shell.nix
resolver: lts-13.26
resolver: lts-13.25
packages:
- .

0 comments on commit 64bc929

Please sign in to comment.