KoaHub.js - Node.js web rapid development framework based on the Koa.js platform. Features such as ES6/7 (Generator Function, Class, Async & Await) can be used directly in the project. With Babel compilation, it can run stably in the Node.js environment.
koahubjs
KoaHub.js - Node.js web rapid development framework based on the Koa.js platform. Features such as ES6/7 (Generator Function, Class, Async & Await) can be used directly in the project. With Babel compilation, it can run stably in the Node.js environment.
Introduction
KoaHub.js - Node.js web rapid development framework based on the Koa.js platform. Features such as ES6/7 (Generator Function, Class, Async & Await) can be used directly in the project. With Babel compilation, it can run stably in the Node.js environment. //base controller, admin/controller/base.controller.js <br>
export default class extends koahub.http{<br>
<br>
constructor() {<br>
super();<br>
console.log('base constructor');<br>
}<br>
<br>
isLogin(){<br>
console.log('base isLogin');<br>
}<br>
}<br>
<br>
//index controller, admin/controller/index.controller.js <br>
import base from "./base.controller";<br>
export default class extends base{<br>
<br>
constructor() {<br>
super();<br>
console.log('index constructor');<br>
}<br>
<br>
index() {<br>
super.isLogin();<br>
super.json({msg: 'this is a msg'});<br>
console.log('index index');<br>
}<br>
}
All features in ES6/7 can be used in the project. With the help of Babel compilation, it can run stably in the Node.js environment of >=0.12.0.
Features
Support all koa middleware
Supports using all features of ES2015+ to develop projects
Supports breakpoint debugging of ES2015+ projects
Supports multiple project structures and multiple project environments
Support multi-level Controller
Support automatic loading
...
Install
npm install koahubjs --save
Create startup file
//Create start.js startup file
var Koahub = require("koahubjs");
//The default app is the project directory
const app = new Koahub.default();
app.getKoa(); Get koahubjs instantiation and support custom koa middleware
app.run(3000);
Directory structure
// Recommended directory structureapp<br>
--addon<br>
--config<br>
--controller<br>
--data<br>
--model<br>
--util<br>
node_modules<br>
src<br>
--addon<br>
--config<br>
--controller<br>
--data<br>
--model<br>
--util<br>
package.json<br>
start.js
Start the application
node start.js
Startup information:
server running at http://127.0.0.1:3000
Documentation
In production....
Official website
http://js.koahub.com