New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

super-api-cache

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

super-api-cache

Super alpha DONT USE IN PRODUCTION version of a API gateway cache module to keep track of underlying micro-services cache dependencies.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

super-api-cache

Super alpha DONT USE IN PRODUCTION version of a API gateway cache module to keep track of underlying micro-services cache dependencies.

With simple labels, each response can be insterted into a list with a track of all dependecies. Clearing a label, will clear all cached responses with that label.

How to use it with restify

const restify = require('restify');
const sac = require('super-api-cache');

const server = restify.createServer({
    name: 'Super API Cache test',
    version: '1.0.0'
});

server.use(restify.acceptParser(server.acceptable));
server.use(restify.queryParser());
server.use(restify.bodyParser());

let cache = await sac.create();

// UGLY
api.server.use(cache.middleware(api.server));

api.get('/foo', (req, res, next) => {

    let data = {hello: 1};

    // key, labels, data
    cache.add('/foo', ['bar'], data);
    res.send(data);

});

server.listen(1337, (err) => {
    if (err) {
        console.log(err);
        return;
    }
});

First type, the endpoint will handle it as usual Next time, it will be handled by the cache.

There are more complex scenarios to show how it is meant to be used, but just in the tests

Keywords

api

FAQs

Package last updated on 09 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts