Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including egg-catbox with all npm packages installed. Try it out:

egg-catbox lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("egg-catbox/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

egg-catbox v2.0.0

Catbox plugin for eggjs


NPM version build status Test coverage David deps Known Vulnerabilities npm download

Catbox plugin for egg framework.


$ npm i egg-catbox --save


// {app_root}/config/plugin.js
exports.catbox = {
  enable: true,
  package: 'egg-catbox',


// {app_root}/config/config.default.js
exports.catbox = {

see config/config.default.js for more detail.


// {app_root}/app/service/user.js
const Service = require('egg').Service;

const segment = 'segment';

class UserService extends Service {
  async save(user, ttl) {
    const id = 'id';
    const key = { id, segment };
    await app.catbox.set(key, user, ttl);
  async load(id) {
    const key = { id, segment };
    const result = await app.catbox.get(key);
    return result ? result.item : null;
  async drop(id) {
    const key = { id, segment };
    await app.catbox.drop(key);

module.exports = UserService;

Questions & Suggestions

Please open an issue here.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free