Make the request.
Get on with it.
The TypeScript HTTP library that gets straight to the point.
One explicit request. Your data, error and meta, together.
data = { id: 'you', name: 'Your next big thing.' }ILLUSTRATIVE RESPONSELESS CEREMONY. MORE SHIPPING.
This is the
whole idea.
Say what you want. Grabkit handles the HTTP request and returns a tuple. Check the error. Use the data. Keep going.
Meet the result tupleimport grabkit from 'grabkit';
const grab = grabkit('https://api.example.com', {
format: 'json',
});
const [data, error, meta] = await grab(
'GET /users/you'
);
if (error) return;
// Yours to build with.
console.log(data, meta.statusCode);SMALL API. CONSIDERED DETAILS.
Less to wire up.
More to work with.
The data you came for.
Read resources with attributes and relationships already merged. Write flat objects. Grabkit builds the JSON:API envelope.
Explore JSON:API ↗Errors belong in the result.
HTTP and transport failures return in the tuple. One check tells you which way to go. Use orThrow when your data layer expects exceptions.
Understand errors ↗Make yourself at home.
Set key casing, headers and a base URL once. Override them per request. Use plain JSON when that's what your API speaks.
Configure your grab ↗BRING YOUR OWN DATA LAYER
Fits the way you build.
Keep your cache. Keep your framework.
Grabkit takes care of the request.
Your next idea
starts with a grab.
Let's build it Open source. Apache 2.0. Yours to use.