1.0.1 • Published 7 years ago

serve-upstream v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

upstream-proxy

A middleware for proxy a upstream resources, support local cache

Usage

const upstream = require('upstream-proxy');

app.use('/upstream', upstream({
  // upstream for fetch from
  origin: 'http://cdn.staticfile.org',

  // upstream work dirctory for localize
  root: getEnv('UPSTREAM_ROOT', ''),

  // Customize a cache directory, true to cache `$TMP/.upstream-proxy/`
  cache: path.join(os.tmpdir(), '.cache'),

  // Localize the upstream to word dirctory
  localize: true,

  // Cache-Control age
  maxage: '30day'
})