Socket
Socket
Sign inDemoInstall

egg-wechat-api-cache

Package Overview
Dependencies
20
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    egg-wechat-api-cache

wechat-api for egg using egg-cache backend


Version published
Weekly downloads
6
increased by50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

egg-wechat-api-cache

NPM version

egg plugin for wechat-api

Install

$ npm i egg-wechat-api-cache --save

use a inmemory cache see node-cache-manager for more cache engine

$ npm i cache-manager-memory-store --save 

Prerequisite

Node.js >= 8.x

Usage

Dependencies

Configuration

// {app_root}/config/plugin.js
exports.wechatApiCache = {
  enable: true,
  package: 'egg-wechat-api-cache',
};

use egg-cache default store

// {app_root}/config/config.default.js
exports.wechatApi = {  
  appId: '',
  appSecret: '',
};

select egg-cache store.

// {app_root}/config/config.default.js
exports.wechatApi = {
  appId: '',
  appSecret: '',
  cacheInstance: '', // select store of egg-cache
};

egg-cache is required !__

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

Example

'use strict';

module.exports = app => {

  app.get('/', function* () {

    const { wechatApi } = app;

    try {
      const ticket = yield wechatApi.getTicket();
      this.status = 200;
      this.body = ticket;

    } catch (error) {
      this.status = 500;
      this.body = error;
    }
  });

};

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Last updated on 25 May 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc