HTTPure
- Package
- purescript-httpure
- Repository
- cprussin/purescript-httpure
Re-exports from HTTPure.Headers
#Headers Source
newtype Headers
The Headers
type is just sugar for a StrMap
of Strings
that
represents the set of headers in an HTTP request or response.
Instances
Re-exports from HTTPure.Lookup
#(!@) Source
Operator alias for HTTPure.Lookup.at (left-associative / precedence 8)
Expose at
as the infix operator !@
#(!?) Source
Operator alias for HTTPure.Lookup.has (left-associative / precedence 8)
Expose has
as the infix operator !?
#(!!) Source
Operator alias for HTTPure.Lookup.lookup (left-associative / precedence 8)
!!
is inspired by !!
in Data.Array
, but note that it differs from
!!
in Data.Array
in that you can use !!
for any other instance of
Lookup
.
Re-exports from HTTPure.Method
Re-exports from HTTPure.Path
#Path Source
type Path = Array String
The Path
type is just sugar for an Array
of String
segments that are
sent in a request and indicates the path of the resource being requested.
Note that this type has an implementation of Lookup
for Int
keys
defined by lookupArray
in Lookup.purs because
lookupArray
is defined for any Array
of Monoids
. So you can do
something like path !! 2
to get the path segment at index 2.
Re-exports from HTTPure.Request
Re-exports from HTTPure.Response
#ResponseM Source
type ResponseM e = Aff (HTTPureEffects e) Response
The ResponseM
type simply conveniently wraps up an HTTPure monad that
returns a response. This type is the return type of all router/route
methods.
#variantAlsoNegotiates' Source
variantAlsoNegotiates' :: forall e. Headers -> ResponseM e
506 with headers
#variantAlsoNegotiates Source
variantAlsoNegotiates :: forall e. ResponseM e
506
#upgradeRequired' Source
upgradeRequired' :: forall e. Headers -> ResponseM e
426 with headers
#upgradeRequired Source
upgradeRequired :: forall e. ResponseM e
426
#unsupportedMediaType' Source
unsupportedMediaType' :: forall e. Headers -> ResponseM e
415 with headers
#unsupportedMediaType Source
unsupportedMediaType :: forall e. ResponseM e
415
#unprocessableEntity' Source
unprocessableEntity' :: forall e. Headers -> ResponseM e
422 with headers
#unprocessableEntity Source
unprocessableEntity :: forall e. ResponseM e
422
#unauthorized' Source
unauthorized' :: forall e. Headers -> ResponseM e
401 with headers
#unauthorized Source
unauthorized :: forall e. ResponseM e
401
#uRITooLong' Source
uRITooLong' :: forall e. Headers -> ResponseM e
414 with headers
#uRITooLong Source
uRITooLong :: forall e. ResponseM e
414
#tooManyRequests' Source
tooManyRequests' :: forall e. Headers -> ResponseM e
429 with headers
#tooManyRequests Source
tooManyRequests :: forall e. ResponseM e
429
#temporaryRedirect' Source
temporaryRedirect' :: forall e. Headers -> Body -> ResponseM e
307 with headers
#temporaryRedirect Source
temporaryRedirect :: forall e. Body -> ResponseM e
307
#switchingProtocols' Source
switchingProtocols' :: forall e. Headers -> ResponseM e
101 with headers
#switchingProtocols Source
switchingProtocols :: forall e. ResponseM e
101
#resetContent' Source
resetContent' :: forall e. Headers -> ResponseM e
205 with headers
#resetContent Source
resetContent :: forall e. ResponseM e
205
#requestTimeout' Source
requestTimeout' :: forall e. Headers -> ResponseM e
408 with headers
#requestTimeout Source
requestTimeout :: forall e. ResponseM e
408
#requestHeaderFieldsTooLarge' Source
requestHeaderFieldsTooLarge' :: forall e. Headers -> ResponseM e
431 with headers
#requestHeaderFieldsTooLarge Source
requestHeaderFieldsTooLarge :: forall e. ResponseM e
431
#rangeNotSatisfiable' Source
rangeNotSatisfiable' :: forall e. Headers -> ResponseM e
416 with headers
#rangeNotSatisfiable Source
rangeNotSatisfiable :: forall e. ResponseM e
416
#proxyAuthenticationRequired' Source
proxyAuthenticationRequired' :: forall e. Headers -> ResponseM e
407 with headers
#proxyAuthenticationRequired Source
proxyAuthenticationRequired :: forall e. ResponseM e
407
#processing' Source
processing' :: forall e. Headers -> ResponseM e
102 with headers
#processing Source
processing :: forall e. ResponseM e
102
#preconditionRequired' Source
preconditionRequired' :: forall e. Headers -> ResponseM e
428 with headers
#preconditionRequired Source
preconditionRequired :: forall e. ResponseM e
428
#preconditionFailed' Source
preconditionFailed' :: forall e. Headers -> ResponseM e
412 with headers
#preconditionFailed Source
preconditionFailed :: forall e. ResponseM e
412
#permanentRedirect' Source
permanentRedirect' :: forall e. Headers -> Body -> ResponseM e
308 with headers
#permanentRedirect Source
permanentRedirect :: forall e. Body -> ResponseM e
308
#paymentRequired' Source
paymentRequired' :: forall e. Headers -> ResponseM e
402 with headers
#paymentRequired Source
paymentRequired :: forall e. ResponseM e
402
#payloadTooLarge' Source
payloadTooLarge' :: forall e. Headers -> ResponseM e
413 with headers
#payloadTooLarge Source
payloadTooLarge :: forall e. ResponseM e
413
#partialContent Source
partialContent :: forall e. Body -> ResponseM e
206
#notModified' Source
notModified' :: forall e. Headers -> ResponseM e
304 with headers
#notModified Source
notModified :: forall e. ResponseM e
304
#notImplemented' Source
notImplemented' :: forall e. Headers -> ResponseM e
501 with headers
#notImplemented Source
notImplemented :: forall e. ResponseM e
501
#notExtended' Source
notExtended' :: forall e. Headers -> ResponseM e
510 with headers
#notExtended Source
notExtended :: forall e. ResponseM e
510
#notAcceptable' Source
notAcceptable' :: forall e. Headers -> ResponseM e
406 with headers
#notAcceptable Source
notAcceptable :: forall e. ResponseM e
406
#nonAuthoritativeInformation' Source
nonAuthoritativeInformation' :: forall e. Headers -> Body -> ResponseM e
203 with headers
#nonAuthoritativeInformation Source
nonAuthoritativeInformation :: forall e. Body -> ResponseM e
203
#noContent' Source
noContent' :: forall e. Headers -> ResponseM e
204 with headers
#networkAuthenticationRequired' Source
networkAuthenticationRequired' :: forall e. Headers -> ResponseM e
511 with headers
#networkAuthenticationRequired Source
networkAuthenticationRequired :: forall e. ResponseM e
511
#multipleChoices' Source
multipleChoices' :: forall e. Headers -> Body -> ResponseM e
300 with headers
#multipleChoices Source
multipleChoices :: forall e. Body -> ResponseM e
300
#multiStatus Source
multiStatus :: forall e. Body -> ResponseM e
207
#movedPermanently' Source
movedPermanently' :: forall e. Headers -> Body -> ResponseM e
301 with headers
#movedPermanently Source
movedPermanently :: forall e. Body -> ResponseM e
301
#misdirectedRequest' Source
misdirectedRequest' :: forall e. Headers -> ResponseM e
421 with headers
#misdirectedRequest Source
misdirectedRequest :: forall e. ResponseM e
421
#methodNotAllowed' Source
methodNotAllowed' :: forall e. Headers -> ResponseM e
405 with headers
#methodNotAllowed Source
methodNotAllowed :: forall e. ResponseM e
405
#loopDetected' Source
loopDetected' :: forall e. Headers -> ResponseM e
508 with headers
#loopDetected Source
loopDetected :: forall e. ResponseM e
508
#lengthRequired' Source
lengthRequired' :: forall e. Headers -> ResponseM e
411 with headers
#lengthRequired Source
lengthRequired :: forall e. ResponseM e
411
#internalServerError' Source
internalServerError' :: forall e. Headers -> Body -> ResponseM e
500 with headers
#internalServerError Source
internalServerError :: forall e. Body -> ResponseM e
500
#insufficientStorage' Source
insufficientStorage' :: forall e. Headers -> ResponseM e
507 with headers
#insufficientStorage Source
insufficientStorage :: forall e. ResponseM e
507
#imATeapot' Source
imATeapot' :: forall e. Headers -> ResponseM e
418 with headers
#hTTPVersionNotSupported' Source
hTTPVersionNotSupported' :: forall e. Headers -> ResponseM e
505 with headers
#hTTPVersionNotSupported Source
hTTPVersionNotSupported :: forall e. ResponseM e
505
#gatewayTimeout' Source
gatewayTimeout' :: forall e. Headers -> ResponseM e
504 with headers
#gatewayTimeout Source
gatewayTimeout :: forall e. ResponseM e
504
#forbidden' Source
forbidden' :: forall e. Headers -> ResponseM e
403 with headers
#failedDependency' Source
failedDependency' :: forall e. Headers -> ResponseM e
424 with headers
#failedDependency Source
failedDependency :: forall e. ResponseM e
424
#expectationFailed' Source
expectationFailed' :: forall e. Headers -> ResponseM e
417 with headers
#expectationFailed Source
expectationFailed :: forall e. ResponseM e
417
#emptyResponse' Source
emptyResponse' :: forall e. Status -> Headers -> ResponseM e
The same as emptyResponse
but with headers.
#emptyResponse Source
emptyResponse :: forall e. Status -> ResponseM e
The same as response
but without a body.
#badRequest Source
badRequest :: forall e. Body -> ResponseM e
400
#badGateway' Source
badGateway' :: forall e. Headers -> ResponseM e
502 with headers
#badGateway Source
badGateway :: forall e. ResponseM e
502
#alreadyReported' Source
alreadyReported' :: forall e. Headers -> ResponseM e
208 with headers
#alreadyReported Source
alreadyReported :: forall e. ResponseM e
208
Re-exports from HTTPure.Server
#ServerM Source
type ServerM e = Eff (HTTPureEffects e) Unit
The ServerM
type simply conveniently wraps up an HTTPure monad that
returns a Unit
. This type is the return type of the HTTPure serve and
related methods.
#SecureServerM Source
type SecureServerM e = ServerM (fs :: FS | e)
The SecureServerM
type is the same as the ServerM
type, but it includes
effects for working with the filesystem (to load the key and certificate).
#serve' Source
serve' :: forall e. Int -> String -> String -> (Request -> ResponseM (fs :: FS | e)) -> SecureServerM e -> SecureServerM e
Create and start an SSL server. This method is the same as serve
, but
takes additional SSL arguments. The arguments in order are:
- A port number
- A path to a cert file
- A path to a private key file
- A handler method which maps
Request
toResponseM
- A callback to call when the server is up
#serve Source
serve :: forall e. Int -> (Request -> ResponseM e) -> ServerM e -> ServerM e
Create and start a server. This is the main entry point for HTTPure. Takes
a port number on which to listen, a function mapping Request
to
ResponseM
, and a ServerM
containing effects to run after the server has
booted (usually logging). Returns an ServerM
containing the server's
effects.
Given a string, return a
Maybe
containing the value of the matching header, if there is any.