-
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.
- Loading branch information
Showing
7 changed files
with
68 additions
and
62 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,6 +1,6 @@ | ||
module Main where | ||
|
||
import App | ||
import App (run) | ||
|
||
main :: IO () | ||
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
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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
module Application (mkApp', mkApp) where | ||
module Application (mkApp) where | ||
|
||
import API | ||
import API.AppServices as AppServices | ||
import API.AppServices | ||
import App.Env qualified as App | ||
import Data.Proxy (Proxy (..)) | ||
import Middleware qualified | ||
import Network.Wai (Application) | ||
import Servant (Context (EmptyContext, (:.)), serveWithContext) | ||
import Servant.Auth.Server (defaultCookieSettings) | ||
import Servant.Auth.Server (defaultCookieSettings, defaultJWTSettings) | ||
|
||
mkApp' :: App.Env -> Application | ||
mkApp' context = | ||
let services = AppServices.start context | ||
app = mkApp services | ||
mkApp :: App.Env -> AppServices -> Application | ||
mkApp env services = | ||
let jwtSettings = defaultJWTSettings env.jwkKey | ||
app = | ||
serveWithContext | ||
(Proxy :: Proxy API) | ||
(defaultCookieSettings :. jwtSettings :. EmptyContext) | ||
(mkAPI services) | ||
in Middleware.apply app | ||
|
||
mkApp :: AppServices -> Application | ||
mkApp appServices = | ||
serveWithContext | ||
(Proxy :: Proxy API) | ||
(defaultCookieSettings :. jwtSettings appServices :. EmptyContext) | ||
(mkAPI appServices) |