oneWalker / egg-pluginDemo

This is a plugin developing demo for the nodejs framework eggjs;

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

egg-pluginDemo

egg-pluginDemo is a demo about how to extend and publish a plugin for egg framework

To do list

  • the minni demo for extend
  • customlize the method to plugin
  • agent.js support
  • ts support
  • test cases

File introduction

|-- egg-pluginDemo
    |-- .autod.conf.js
    |-- .eslintignore
    |-- .eslintrc
    |-- .gitignore
    |-- .travis.yml
    |-- app.js // the entry js file
    |-- LICENSE
    |-- package-lock.json
    |-- package.json
    |-- README.md
    |-- app   // the extend for eggplugin, which have the same functions for the extend module in eggjs
    |   |-- extend
    |       |-- application.js
    |-- config //define the config constant variable
    |   |-- config.default.js
    |-- lib    //the main method js file
        |-- pluginDemo.js

Usage

install

  • npm pulished
    • npm i egg-pluginDemo --save
  • npm unpublished
    • download the project and copy it into the file catalog

add to //config/plugin.js

  • npm published
pluginDemo:{
    enable: true,
    package: 'egg-pluginDemo',
  },
  • npm unpulished
pluginDemo:{
    enable: true,
    path: path.join(__dirname,'/../..'),
  },
  • use it in the controller and service
let res = await this.ctx.pluginDemo.testSend(msg);

Questions & Suggestions

Please open an issue here.

License

MIT

About

This is a plugin developing demo for the nodejs framework eggjs;

License:MIT License


Languages

Language:JavaScript 100.0%