Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
fetch-fetchy
Advanced tools
→ Methods for each HTTP verb means no building request objects
→ API-level error handling means no checking status codes
→ Built-in response parsing means no additional checks and method calls
→ Optional one-time configuration means easy integration for your API
$ npm i --save fetch-fetchy
import { get, post } from 'fetch-fetchy';
/**
* Create a user
*/
post('/user', formData)
.then(onSuccess)
.catch(onError)
/**
* Fetch a user
*/
get('/user/hs9hsbs7')
.then(onSuccess)
.catch(onError)
The default configuration is as follows:
{
json: true,
url: window.location.origin,
headers: { 'Content-Type': 'application/json' },
mode: 'cors'
}
json
If set to true
, request data will automatically be converted to JSON.
url
The url
to be used for api
requests. When a route begins with /
, it is assumed that the request is being made to the application's API. This means that you can define /user
as the route instead of https://myapplicationdomain/user
. If you set url
to https://someotherdomain
and specify /user
as the route, the request will be made to https://someotherdomain/user
. When the route does not begin with /
, the full route will be used.
headers
The headers for requests.
mode
The request mode.
You may override these options for all requests by calling configure()
. The default options will be overridden using Object.assign()
. If you wish to apply options for a single request, just pass those options into that request.
import { configure } from 'fetch-fetchy';
/**
* Configure fetch-fetchy
*/
const options = {
url: 'https://myapi.com',
headers: { Authorization: `Bearer ${jwt}`},
}
configure(options);
get(route: String, options: Object) => Promise
post(route: String, body: *, options: Object) => Promise
put(route: String, body: *, options: Object) => Promise
patch(route: String, body: *, options: Object) => Promise
del(route: String, options: Object) => Promise
configure(options: Object) => Object
FAQs
A simplified fetch api
The npm package fetch-fetchy receives a total of 1 weekly downloads. As such, fetch-fetchy popularity was classified as not popular.
We found that fetch-fetchy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.