Hello World, this is the beginning of 2 Part Series on "How to make your REST APIs blazing fast 🚀". These are from my personal experiences and from...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks!
I will leave my implementation to help others to figure out how to implement this approach
It seems that you're using URL as cache key, right? Things to be considered:
What's your cache backend?
Both of these considerations depend upon one's own project and what routes they want to cache. This example works best for data that only dependents on the URL and not any context like current user.
I wrote a similar one but saving data in Cloudflare edge servers coffeencoding.com/how-i-used-cloud...
Awesome Post 🏆
Can you explain the processQuery, responseHandler fuction for me.
Hey,
processQuery
&responseHandler
are not anything related to caching or have anything to do with this artcle. They are just examples of common middlewares.In our app,
processQuery
transforms some of our url query params, does some checks if they are valid.responseHandler
just converts the response data to json and returns a 200 status.This may not be everyone's usecase.
thank bro
Thank you. Do you still have this tutorial. i don't see it on your github
function getUrlFromRequest(req) {
const url = req.protocol + '://' + req.headers.host + req.originalUrl
return url
}
becasue of req.protocol in key the cache is not effective as can be :)
Hi, can you please share index file also ?