From 868e6682963e9ee7d6851838df18b86e523bfd81 Mon Sep 17 00:00:00 2001 From: Connor Prussin Date: Tue, 1 Aug 2017 21:04:11 -0700 Subject: [PATCH 1/2] Move important functions first --- src/Node/HTTP/Secure.purs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Node/HTTP/Secure.purs b/src/Node/HTTP/Secure.purs index 66fe288..413967d 100644 --- a/src/Node/HTTP/Secure.purs +++ b/src/Node/HTTP/Secure.purs @@ -91,6 +91,22 @@ import Unsafe.Coerce (unsafeCoerce) -- | The type of HTTPS server options data SSLOptions +-- | Create an HTTPS server, given the SSL options and a function to be executed +-- | when a request is received. +foreign import createServerImpl :: + forall eff. + Foreign -> + (Request -> Response -> Eff (http :: HTTP | eff) Unit) -> + Eff (http :: HTTP | eff) Server + +-- | Create an HTTPS server, given the SSL options and a function to be executed +-- | when a request is received. +createServer :: forall eff. + Options SSLOptions -> + (Request -> Response -> Eff (http :: HTTP | eff) Unit) -> + Eff (http :: HTTP | eff) Server +createServer = createServerImpl <<< options + -- | See the [node docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener) handshakeTimeout :: Option SSLOptions Int handshakeTimeout = opt "handshakeTimeout" @@ -264,19 +280,3 @@ secureOptions = opt "secureOptions" -- | See the [node docs](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) sessionIdContext :: Option SSLOptions String sessionIdContext = opt "sessionIdContext" - --- | Create an HTTPS server, given the SSL options and a function to be executed --- | when a request is received. -foreign import createServerImpl :: - forall eff. - Foreign -> - (Request -> Response -> Eff (http :: HTTP | eff) Unit) -> - Eff (http :: HTTP | eff) Server - --- | Create an HTTPS server, given the SSL options and a function to be executed --- | when a request is received. -createServer :: forall eff. - Options SSLOptions -> - (Request -> Response -> Eff (http :: HTTP | eff) Unit) -> - Eff (http :: HTTP | eff) Server -createServer = createServerImpl <<< options From f59e5fe87912ab7de816132b180903076bdb9c33 Mon Sep 17 00:00:00 2001 From: Connor Prussin Date: Wed, 2 Aug 2017 09:42:37 -0700 Subject: [PATCH 2/2] Even higher --- src/Node/HTTP/Secure.purs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Node/HTTP/Secure.purs b/src/Node/HTTP/Secure.purs index 413967d..7c5a14e 100644 --- a/src/Node/HTTP/Secure.purs +++ b/src/Node/HTTP/Secure.purs @@ -88,9 +88,6 @@ import Node.Buffer (Buffer) import Node.HTTP (Request, Response, Server, HTTP) import Unsafe.Coerce (unsafeCoerce) --- | The type of HTTPS server options -data SSLOptions - -- | Create an HTTPS server, given the SSL options and a function to be executed -- | when a request is received. foreign import createServerImpl :: @@ -107,6 +104,9 @@ createServer :: forall eff. Eff (http :: HTTP | eff) Server createServer = createServerImpl <<< options +-- | The type of HTTPS server options +data SSLOptions + -- | See the [node docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener) handshakeTimeout :: Option SSLOptions Int handshakeTimeout = opt "handshakeTimeout"