Module

Node.Express.Request

Package
purescript-express
Repository
nkly/purescript-express

#getRouteParam Source

getRouteParam :: forall a. RequestParam a => a -> HandlerM (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 a. String -> HandlerM (Maybe a)

Get param from query string (part of URL behind '?'). It could be any JS object, e.g. an array in case multiple repeating query parameters, or an object in case of nested query parameters (this particular behavior depends on the type of query parser - 'simple' won't parse complex objects, see https://github.com/expressjs/express/blob/master/test/req.query.js)

#getQueryParams Source

getQueryParams :: forall a. String -> HandlerM (Maybe (Array a))

Shortcut for getQueryParam paramName :: HandlerM (Maybe (Array a))

#getBody Source

getBody :: forall a. Decode a => HandlerM (F 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' :: HandlerM 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. String -> HandlerM (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 :: HandlerM String

Return route that matched this request.

#getCookie Source

getCookie :: String -> HandlerM (Maybe String)

Get cookie param by its key.

#getSignedCookie Source

getSignedCookie :: String -> HandlerM (Maybe String)

Get signed cookie param by its key.

#getRequestHeader Source

getRequestHeader :: String -> HandlerM (Maybe String)

Get request header param.

#accepts Source

accepts :: String -> HandlerM (Maybe String)

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

#ifAccepts Source

ifAccepts :: String -> Handler -> Handler

Execute specified handler if client accepts specified response type.

#acceptsCharset Source

acceptsCharset :: String -> HandlerM (Maybe String)

Check if specified charset is accepted.

#acceptsLanguage Source

acceptsLanguage :: String -> HandlerM (Maybe String)

Check if specified language is accepted.

#hasType Source

hasType :: String -> HandlerM Boolean

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

#getRemoteIp Source

getRemoteIp :: HandlerM String

Return remote or upstream address.

#getRemoteIps Source

getRemoteIps :: HandlerM (Array String)

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

#getPath Source

getPath :: HandlerM String

Return request URL pathname.

#getHostname Source

getHostname :: HandlerM String

Return Host header field.

#getSubdomains Source

getSubdomains :: HandlerM (Array String)

Return array of subdomains.

#isFresh Source

isFresh :: HandlerM Boolean

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

#isStale Source

isStale :: HandlerM Boolean

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

#isXhr Source

isXhr :: HandlerM Boolean

Check if request was issued by XMLHttpRequest.

#getProtocol Source

getProtocol :: HandlerM (Maybe Protocol)

Return request protocol.

#getMethod Source

getMethod :: HandlerM Method

Return request HTTP method

#getUrl Source

getUrl :: HandlerM String

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

#getOriginalUrl Source

getOriginalUrl :: HandlerM String

Return request original URL.

#getUserData Source

getUserData :: forall a. String -> HandlerM (Maybe a)

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

#setUserData Source

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

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