Repository URL to install this package:
|
Version:
1.1.13 ▾
|
export function createProxyCacheMiddleware(proxyConfig) {
/**
* @inheritdoc
* @description wraps api requests to use our cache > backend one
* @type {Express.middleware}
* @listens /api
*/
function proxyWrap(req, res, next) {
const hash = fromRequestToHash(res, '/apiproxy/')
console.log('[uxui-apis] REQUESTING_STREAM: ', '\n' + proxyConfig.target + '\n\n')
console.log(proxyConfig)
// if (oneStorage.has(hash) && nocache(req) === false) {
// // console.log('node cached')
// // require('fliplog').cyan('yay! cached!').data(hash).echo()
// res.send(oneStorage.get(hash))
// } else {
// // console.log('node uncached')
// // require('fliplog').yellow('sadness! uncached!').data(hash).echo()
// next()
// }
// return undefined
}
// if (DISABLE_CUSTOM_PROXY_CACHE === true) {
// api.use(route, proxyWrap)
return proxyWrap
}