README
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!
becomesOPTIONS /resource
, good for showing an edit formPOST /resource!!
becomesDELETE /resource
, good for deleting a resource
In all other cases, !!
and !
get stripped from your path.
Dependencies
gpod-request
Get/Post/Options/Delete Request mapper
- gpod-request
- module.exports ⏏
- new module.exports(req)
- instance
- .url
- .getBody() ⇒
string
- .getData() ⇒
URLSearchParams
- static
- module.exports ⏏
module.exports ⏏
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
string
module.exports.getBody() ⇒ Return the body as a string
Kind: instance method of module.exports
URLSearchParams
module.exports.getData() ⇒ 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
Param | Type |
---|---|
request | Request |