Hello world, welcome Tinka
Nishchal Gautam
Managing Complexity in code (Software Engineering)Hello world, I'm introducing tinka to the mix.
Few years ago @wmathes asked me to find a http client which was similar to aurelia http client (this was before angularjs)
I did a lot of research and found axios, and a few others whose name weren't even heard of.
At that point, axios didn't include any type definitions, it didn't have middleware functionality, basically the set of requirements I was given simply wasn't done by axios (I don't think it still does).
After not finding anything worth it's salt, we decided to roll our own: tinka
, it's fetch http client, which has no dependency (really, check out package.json) and would be as close to fetch as we could possibly make.
The best decision for tinka
was to make middleware it's first class citizen, literally everything's a middleware (the part of code which makes the actual fetch call, is also a middleware)
I've been using tinka for a long time now, and I must say it's been great so far. Because the way middleware works, it's made my development so easy.
Adding response time, doing refresh tokens on expired jwt, automatically adding jwt to all requests etc are all done through this middleware.
Last time I checked, axios now has middleware support I think it's called interceptors. And here's what it looks like
My first problem would be, how do I log time taken for a particular request to my server for analytics purpose, monitoring SLAs etc, (remember, you can't only measure response time on server side, you must also do it on client side)
Here's how you do it with tinka:
Tinka shines when Sdk is provided for a while API with all types, the perfect setup would be to have a npm package which you install when you want to consume a particular API.
You can also look at a usage example here: https://github.com/fossapps/Feature.Manager.Ui/tree/master/src/Sdk