xyquest
A proxy based HTTP requests utility
Installation
npm install --save xyquest
Examples
xyquest is a flexible HTTP lib, which utilises adapters of the form:
;
Included within is a simple adapter based on the request module.
request
Usage with const request = ;const xyquest = request 'https://jsonplaceholder.typicode.com' json: true ; { const comment = await xyquestpostspostIdcomments; Object; await xyquestcommentscommentid; return true;}
Frontend Usage
You can use use the special xyquest/es5
module to import an uglifiable version of this lib. Here's an example using it and the builtin fetch
function:
{ optionsmethod = optionsmethod; const body = ; body; optionsbody = body; return ;} const xyquest = fetchAdapter 'https://jsonplaceholder.typicode.com'; { const comment = await xyquestpostspostIdcomments; Object; await xyquestcommentscommentid; return true;}
hyphenate
A note about xyquest options all have a hyphenate
key that is set to true
by default. It ensures that calling props like xyquest.userControls
will be translated to the url /user-controls
. If your API does'nt follow this convention, you can set it to false
globally or individually.