Move to upstream purescript-node-http
. (#59)
Move to upstream `purescript-node-http`
This commit is contained in:
parent
500970b003
commit
61a66c324a
@ -18,9 +18,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"purescript-prelude": "^3.0.0",
|
||||
"purescript-node-http": "cprussin/purescript-node-http#dd87dbaec43ffc5312b78b10316023dc7b78a06d",
|
||||
"purescript-aff": "^3.1.0",
|
||||
"purescript-node-fs": "^4.0.0"
|
||||
"purescript-node-fs": "^4.0.0",
|
||||
"purescript-node-http": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"purescript-psci-support": "^3.0.0",
|
||||
|
@ -13,6 +13,7 @@ import Data.Options ((:=))
|
||||
import Node.Encoding as Encoding
|
||||
import Node.FS.Sync as FSSync
|
||||
import Node.HTTP as HTTP
|
||||
import Node.HTTP.Secure as HTTPS
|
||||
|
||||
import HTTPure.HTTPureM as HTTPureM
|
||||
import HTTPure.Request as Request
|
||||
@ -60,11 +61,14 @@ bootHTTPS :: forall e.
|
||||
ServerM e ->
|
||||
ServerM e
|
||||
bootHTTPS options cert key router onStarted = do
|
||||
certText <- FSSync.readTextFile Encoding.UTF8 cert
|
||||
keyText <- FSSync.readTextFile Encoding.UTF8 key
|
||||
let sslOptions = HTTP.key := keyText <> HTTP.cert := certText
|
||||
HTTP.createServerS sslOptions (handleRequest router) >>= \server ->
|
||||
cert' <- FSSync.readTextFile Encoding.UTF8 cert
|
||||
key' <- FSSync.readTextFile Encoding.UTF8 key
|
||||
server <- HTTPS.createServer (sslOpts key' cert') (handleRequest router)
|
||||
HTTP.listen server options onStarted
|
||||
where
|
||||
sslOpts key' cert' =
|
||||
HTTPS.key := HTTPS.keyString key' <>
|
||||
HTTPS.cert := HTTPS.certString cert'
|
||||
|
||||
-- | Given a port number, return a HTTP.ListenOptions Record.
|
||||
listenOptions :: Int -> HTTP.ListenOptions
|
||||
|
Loading…
Reference in New Issue
Block a user