request-ajax handler to proxy API's cache-control header
$ npm install --save express-request-ajax-cache-header
Below is a example of usage.
var express = require('express');
var ajax = require('request-ajax');
var ajaxCacheHeader = require('express-request-ajax-cache-header');
var app = express();
app.use(function(req, res, next) {
// bind error handler to `res.locals`
res.locals.setCacheByAPI = ajaxCacheHeader(req, res);
});
app.get('/', function(req, res, next){
ajax({
url: 'http://my-api.com/test.json'
// use as callback
complete: res.locals.setCacheByAPI,
success: function(){
res.send('ok');
}
});
});