serve-upstream

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i serve-upstream

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • allex