Home > php教程 > php手册 > To tp developers, the first version of koahubjs on the road to node

To tp developers, the first version of koahubjs on the road to node

WBOY
Release: 2016-09-09 08:12:51
Original
1412 people have browsed it

第一弹 koahub-loader KoaHub.js -- 基于 Koa.js 平台的 Node.js web 快速开发框架
Installation<br> <br> $ npm install koahub-loader<br> Use with koa<br> <br>  // 1.model loader<br>  var model = loader([<br>  {<br>      root: './app/model',<br>      suffix: '.model.js'<br>  },<br>  {<br>      root: './addon',<br>      suffix: '.model.js',<br>      filter: [/w*/model//]<br>  }<br>  ]);<br> <br>  // 2.controller loader<br>  var app = require('koa')();<br>  var router = require('koa-router')();<br>  var controller = loader([<br>  {<br>     root: './app/controller',<br>     suffix: '.controller.js',<br>     prefix: '/',<br>  }, {<br>     root: './addon',<br>     suffix: '.controller.js',<br>     prefix: '/addon/',<br>     filter: [/w*/controller//]<br>  }<br>  ]);<br> <br>  for (var key in controller) {<br>     router.use(key, controller[key].routes());<br>  }<br>  app.use(router.routes());<br> <br>  // 3.util loader<br>  var util = loader([<br>  {<br>      root: './app/common',<br>      suffix: '.util.js'<br>  },<br>  {<br>      root: './addon',<br>      suffix: '.util.js',<br>      filter: [/w*/common//]<br>  }<br>  ]);官网: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