Git Product home page Git Product logo

egg-plugin-ua's Introduction

Usage

需要将本项目和主项目放在同级目录下

🚀🚀🚀 step 1

1: 在 plugin 项目的 package.json 里 声明 "eggPlugin": { "name": "ua" // 这个名字和步骤3中exports里保持一致 }

🚀🚀🚀 step 2

2: 在主项目里的 package.json 里添加依赖 "dependencies":{ "egg-plugin-ua": "../egg-plugin-ua" }

🚀🚀🚀 step 3

3: 在主项目里的 config/plugin 里添加 exports.ua = { enable: true, package: 'egg-plugin-ua' };

🚀🚀🚀 step 4

在主项目中的controller中使用this.ctx调用在插件中定义的方法

The different between middleware and plugin

中间件更接近于处理整个application的逻辑或是某个指定路由的逻辑 插件更倾向于处理全局的共通的方法.

egg-plugin-ua's People

Watchers

James Cloos avatar suzhen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.