Module

Node.Express.Request

Package
purescript-express
Repository
nkly/purescript-express

#getRouteParam Source

getRouteParam :: forall a e. RequestParam a => a -> HandlerM (express :: EXPRESS | e) (Maybe String)

Get route param value. If it is named route, e.g /user/:id then getRouteParam "id" return matched part of route. If it is regex route, e.g. /user/(\d+) then getRouteParam 1 return part that matched (\d+) and getRouteParam 0 return whole route.

#getQueryParam Source

getQueryParam :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Get param from query string (part of URL behind '?'). If there are multiple params having equal keys return the first one.

#getQueryParams Source

getQueryParams :: forall e. String -> HandlerM (express :: EXPRESS | e) (Array String)

Get all params from query string having specified key.

#getBody Source

getBody :: forall a e. Decode a => HandlerM (express :: EXPRESS | e) (Either MultipleErrors a)

Get the request's body. NOTE: Not parsed by default, you must attach proper middleware See http://expressjs.com/4x/api.html#req.body

#getBody' Source

getBody' :: forall e. HandlerM (express :: EXPRESS | e) Foreign

Get the request's body without a Decode parsing. NOTE: Not parsed by default, you must attach proper middleware See http://expressjs.com/4x/api.html#req.body

#getBodyParam Source

getBodyParam :: forall a e. Decode a => String -> HandlerM (express :: EXPRESS | e) (Maybe a)

Get param from request's body. NOTE: Not parsed by default, you must attach proper middleware See http://expressjs.com/4x/api.html#req.body

#getRoute Source

getRoute :: forall e. HandlerM (express :: EXPRESS | e) String

Return route that matched this request.

#getCookie Source

getCookie :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Get cookie param by its key.

#getSignedCookie Source

getSignedCookie :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Get signed cookie param by its key.

#getRequestHeader Source

getRequestHeader :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Get request header param.

#accepts Source

accepts :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Check if specified response type will be accepted by a client.

#ifAccepts Source

ifAccepts :: forall e. String -> Handler e -> Handler e

Execute specified handler if client accepts specified response type.

#acceptsCharset Source

acceptsCharset :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Check if specified charset is accepted.

#acceptsLanguage Source

acceptsLanguage :: forall e. String -> HandlerM (express :: EXPRESS | e) (Maybe String)

Check if specified language is accepted.

#hasType Source

hasType :: forall e. String -> HandlerM (express :: EXPRESS | e) Boolean

Check if request's Content-Type field matches type. See http://expressjs.com/4x/api.html#req.is

#getRemoteIp Source

getRemoteIp :: forall e. HandlerM (express :: EXPRESS | e) String

Return remote or upstream address.

#getRemoteIps Source

getRemoteIps :: forall e. HandlerM (express :: EXPRESS | e) (Array String)

Return list of X-Forwarded-For proxies if any.

#getPath Source

getPath :: forall e. HandlerM (express :: EXPRESS | e) String

Return request URL pathname.

#getHostname Source

getHostname :: forall e. HandlerM (express :: EXPRESS | e) String

Return Host header field.

#getSubdomains Source

getSubdomains :: forall e. HandlerM (express :: EXPRESS | e) (Array String)

Return array of subdomains.

#isFresh Source

isFresh :: forall e. HandlerM (express :: EXPRESS | e) Boolean

Check that Last-Modified and/or ETag still matches.

#isStale Source

isStale :: forall e. HandlerM (express :: EXPRESS | e) Boolean

Check that Last-Modified and/or ETag do not match.

#isXhr Source

isXhr :: forall e. HandlerM (express :: EXPRESS | e) Boolean

Check if request was issued by XMLHttpRequest.

#getProtocol Source

getProtocol :: forall e. HandlerM (express :: EXPRESS | e) (Maybe Protocol)

Return request protocol.

#getMethod Source

getMethod :: forall e. HandlerM (express :: EXPRESS | e) (Maybe Method)

Return request HTTP method

#getUrl Source

getUrl :: forall e. HandlerM (express :: EXPRESS | e) String

Return request URL (may be modified by other handlers/middleware).

#getOriginalUrl Source

getOriginalUrl :: forall e. HandlerM (express :: EXPRESS | e) String

Return request original URL.

#getUserData Source

getUserData :: forall a e. Decode a => String -> HandlerM (express :: EXPRESS | e) (Maybe a)

Retrieves the data from the request set with previous call to setUserData

#setUserData Source

setUserData :: forall e a. String -> a -> Handler e

Sets the specified field of the userData object attached to the Request object to specified data