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
#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.
#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.
#getHostname Source
getHostname :: HandlerM String
Return Host header field.
#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