Get/Post/Options/Delete Request Mapper
Wouldn't it be nice to be able to use OPTIONS or DELETE methods in the browser?
This library lets you do this by treating URLs ending in the !
character as special cases.
GET /resource!
becomes OPTIONS /resource
, good for showing an edit formPOST /resource!!
becomes DELETE /resource
, good for deleting a resource
In all other cases, !!
and !
get stripped from your path.
Dependencies
None
gpod-request
Get/Post/Options/Delete Request mapper
See: module:new-lib.default
module.exports ⏏
Kind: Exported class
new module.exports(req)
Map a Node request object to a generic GPOD request
Param | Type | Description |
---|
req | HTTP.IncomingRequest | The Node request object |
module.exports.url
Return the path and query part of this object combined
Kind: instance property of module.exports
module.exports.getBody() ⇒ string
Return the body as a string
Kind: instance method of module.exports
module.exports.getData() ⇒ URLSearchParams
Return the body as a SearchParams object
Kind: instance method of module.exports
module.exports.url(request) ⇒
Turn the request back to a GET/POST url
Kind: static method of module.exports
Returns: string