eggjs/egg-subapp

Name: egg-subapp

Owner: egg

Description: an egg plugin for create multi-site applications quickly and easily

Created: 2018-01-02 16:02:48.0

Updated: 2018-02-24 06:39:42.0

Pushed: 2018-02-04 13:45:00.0

Homepage: null

Size: 22

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

egg-subapp

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

help you create multi-site applications quickly and easily

??
i egg-subapp --save
?????
????
onfig/plugin.js
rts.subapp = {
able: true,
ckage: 'egg-subapp',

????

????????


demo.subapp.com
|- controller
|- middleware
|- service
|- router
   |- index.js
   |- book.js
   |- ...
demo2.subapp.com
|- ...

????????????????????controller?middleware?service??????????

controller?middleware????egg?????????????controller??service??????

s HomeController extends Controller {
ync findUser() {
const { ctx } = this;
// ??ctx.subAppService???service????
ctx.body = await ctx.subAppService.user.findUser();


????
onfig/config.default.js
rts.subApp = {
rtualHosts: {
// ???????
'custom-domain.com': 'demo.subapp.com',

ddleware: {
// ??????????????
// 'demo.subapp.com': [ needLogin, ... ],


?? config/config.default.js ??????????

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.