0.2.1 • Published 7 years ago

express-apps v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

express-apps

为express提供子系统注册服务
依赖 getapp

Install

npm i express-apps --save

Usage For Express

为基于express实现的后台提供子系统注册

const app = express()
const App = require('express-apps')

app.set('apps.path', '/g');
app.set('apps.static', '/g/static');
app.use(App.reg(app, path.join(__dirname, 'apps')))

Usage For Express-apps

开发基于express-apps的子系统

const path = require('path')
const App = require('express-apps')

class Stats extends App {
    constructor(parent){
        super(parent)
        this.name = 'stats'
    }

    reg() {
        this.init()
        this.routes()
        this.static(path.join(__dirname, 'static'))
    }

    routes(routes) {
        this.router
            .get('/', (req, res) => res.send(`Hello ${this.name}`))
    }
}

module.exports = Stats
0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago