-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all the code into the library (src/) for maximum ergonomics
- Loading branch information
Showing
6 changed files
with
45 additions
and
36 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 |
---|---|---|
@@ -1,31 +1,6 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Main where | ||
|
||
import API.AppServices as AppServices | ||
import API.Application (app) | ||
import API.Config (Port (..), apiPort) | ||
import qualified API.Config as Config | ||
import CLIOptions (CLIOptions (configPath)) | ||
import qualified CLIOptions | ||
import Dependencies (Deps (..)) | ||
import qualified Dependencies as Deps | ||
import qualified Infrastructure.Logging.Logger as Logger | ||
import qualified Middleware | ||
import qualified Network.Wai.Handler.Warp as Warp | ||
import qualified Tagger.JSONWebKey as JWK | ||
import App | ||
|
||
main :: IO () | ||
main = do | ||
options <- CLIOptions.parse | ||
appConfig <- Config.load $ configPath options | ||
key <- JWK.setup options | ||
|
||
Deps.withDeps appConfig $ \Deps {dbHandle, loggerHandle} -> do | ||
let (Port port) = apiPort . Config.api $ appConfig | ||
services = AppServices.start dbHandle loggerHandle key | ||
application = Middleware.apply (app services) | ||
|
||
Logger.logInfo loggerHandle $ "Starting app on port " <> show port <> "." | ||
Warp.run port application | ||
main = run |
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
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
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,31 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module App where | ||
|
||
import API.AppServices as AppServices | ||
import API.Application (app) | ||
import API.Config (Port (..), apiPort) | ||
import qualified API.Config as Config | ||
import CLIOptions (CLIOptions (configPath)) | ||
import qualified CLIOptions | ||
import Dependencies (Deps (..)) | ||
import qualified Dependencies as Deps | ||
import qualified Infrastructure.Logging.Logger as Logger | ||
import qualified Middleware | ||
import qualified Network.Wai.Handler.Warp as Warp | ||
import qualified Tagger.JSONWebKey as JWK | ||
|
||
run :: IO () | ||
run = do | ||
options <- CLIOptions.parse | ||
appConfig <- Config.load $ configPath options | ||
key <- JWK.setup options | ||
|
||
Deps.withDeps appConfig $ \Deps {dbHandle, loggerHandle} -> do | ||
let (Port port) = apiPort . Config.api $ appConfig | ||
services = AppServices.start dbHandle loggerHandle key | ||
application = Middleware.apply (app services) | ||
|
||
Logger.logInfo loggerHandle $ "Starting app on port " <> show port <> "." | ||
Warp.run port application |
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
File renamed without changes.