Package Exports
- mkbugjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mkbugjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mkbug.js
An OOP style declare Nodejs framework base on Express.js!
What is mkbug.js
An OOP Style Restful Api framewrok base on Express.js,and make Nodejs development beautiful and easy.
Mkbug.js VS Egg.js VS Think.js
项目 | Mkbug.js | Egg.js | Think.js |
---|---|---|---|
Nodejs | Nodejs 10+ | Nodejs 8+ | Nodejs 6+ |
Base on | Express.js | Koa.js | Koa.js |
Router | Auto | Manual | Auto |
Plugin | Auto | Manual | Manual |
Middleware | Auto+Manual | Manual | Manual |
Config | Auto | No | No |
JS extend | ES6 | ES6 | Babel |
Style | OOP | Pure | Pure |
Duration | Yes | No | No |
Extend Capability | compatible expressjs | egg ecology | compatible koa |
Your First Mkbug Application
// index.js
const express = require('express');
const app = express();
const { Mkbug } = require('mkbugjs');
new Mkbug(app)
.create('/') // 请求url前缀
.use(bodyParser.json()) // 使用express中间件
.start(3001, (err) => { // 启动,同app.listen
if (!err)
console.log('Server started!')
else
console.error('Server start failed!')
})
// src/controller/index.js
const { BaseController } = require('mkbugjs');
module.exports = class api extends BaseController {
getAction () {
return 'Hello World';
}
}