I see alot of other questions on this but as Node.js is a server-side language "Etag support" seems to be referring to the a nodejs app creating, sending and handling what code to give back to their client. In my case I am requesting and not sending resources and saving all 200 responses to my firebase db for mobile users to use and updating when I get another 200 response (rather than the 304) when I match the Etag value to If-None-Match
header to send back out for additional requests to see if there is a change in the resource.
Also, what's the proper terminology in this case. Am I the client and my mobile app users are my client, so they're the client's client?
I using reqest and was wondering if there is an easier way than setting a local etag
variable, check if it's set if not, then use one set of headers one without an empty 'If-None-Match'
and another with it, and use it when you grab it in the response grab like so
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
var info = body;
var etag = headers.etag;
returnEtag(etag)
then having to grab and return it in the returnEtag()
function and use it in the second set of headers and so on.
This gets messy not to mention I'd have to do this through my entire app to manage each etag
for each different request there an simpler/easier way. Are there any module with support for handling this out of the box?
The documentation states i should do the following
All responses return an HTTP Cache-Control header. It’s content indicates how long a cached response can be used to reduce unnecessary API requests. Clients accessing the this API MUST regard this information.
In addition to that, each response returns an HTTP ETag header. It’s content is to be used in subsequent requests to the same resource in an HTTP If-None-Match header. The API will then return a status code 304 Not Modified if the cached information is still valid. Clients accessing the This API MUST use this technique, also known as conditional GET.
Im using my own server to access this API then saving that data to a firebase that can be accessed my users on a mobile app (keeping app my keys with this other companies api away from the mobile app users).