Home > php教程 > php手册 > body text

KoaHub.js is compiled and run on the Node.js environment with Babel

WBOY
Release: 2016-10-09 08:32:19
Original
1443 people have browsed it

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.jsStart 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

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!