egg-micro-app

0.0.2 • Public • Published

egg-micro-app

By expanding the Egg project directory, the Egg micro application is realized

English | 简体中文

Install

npm i egg-micro-app --save

Example

Micro application

According to different business modules, split the original app into several microApp in egg.

- app
  - microApp1
  - microApp2
  - microApp3
    - controller
    - service
    - router.js

Access the NPM package in package.json

{
  "name": "your-project",
  ...
  "egg": {
    "framework": "egg-micro-app"
  },
  ...
}

In the config folder in the egg directory, create a new file framework.config.js(framework.config.ts if you use TypeScript).

// framework.config.js
const path = require('path');

module.exports = {
  app: [
    path.join(process.cwd(), 'app/microApp1'),
    path.join(process.cwd(), 'app/microApp2'),
    path.join(process.cwd(), 'app/microApp3'),
  ],
};

Micro application nesting

If the module becomes more and more bloated, you can split it up.

- app
  - microApp
    - subMicroApp1
    - subMicroApp2
// framework.config.js
const path = require('path');

module.exports = {
  app: [
    path.join(process.cwd(), 'app/microApp/subMicroApp1'),
    path.join(process.cwd(), 'app/microApp/subMicroApp2'),
  ],
};

Usage

Configuration config description.

property type description
app string[] Defines the absolute path of the micro application
router string[] Customize the absolute path to the Router file
controller string[] Customize the absolute path to the directory of Controller file
service string[] Customize the absolute path to the directory of Service file
extend string[] Customize the absolute path to the directory of the Extend file
constant string[] Customize the absolute path to the directory of the constant file

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    0
  • 0.0.1
    1

Package Sidebar

Install

npm i egg-micro-app

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

10.7 kB

Total Files

10

Last publish

Collaborators

  • erencode