Skip to content

Tickaroo/express-request-ajax-cache-header

Repository files navigation

express-request-ajax-cache-header

npm version Build Status codecov.io

request-ajax handler to proxy API's cache-control header

Install

$ npm install --save express-request-ajax-cache-header

Usage

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');
    }
  });
});

About

request-ajax handler to proxy API's cache-control header

Resources

Stars

Watchers

Forks

Packages

No packages published