基于koa-based的node应用框架epii-server

  • 开源协议:MIT
  • 操作系统: Windows Linux OS X
  • 开发语言:Js
  • 项目所有者:epii-io
  • 收录时间:2017-07-23
  • 分享:
编辑评级
3

项目详细介绍

epii-server是基于koa的node应用框架,服务与构建渲染工具分离,提供更纯粹的MVC开发体验。

具有以下特性:

MVC 管道

(Request)
      =>   Middleware   =>   Controller   =>   View   =>
(Response)

ASP.net-liked

不同的ActionResult会产生不同的响应

//   controller
module.exports   =   [
      {
            path:   '/',
            verb:   'get',
            body:   async   function   ()   {
                  //   response   text/plain
                  return   this.epii.text('text   output')
                  //   response   application/json
                  return   this.epii.json({   state:   true   })
                  //   response   text/html   by   ViewRender
                  return   this.epii.view({   name:   'Li   Lei'   })
                  //   response   application/octet-stream
                  return   this.epii.file('dataset.csv')
            }
      }
]

支持自定义布局

//   client/index.meta.js
module.exports   =   {
      base:   'simple',   //   inherit   simple   layout
      head:   {
            styles:   'client/index.css'
      },
      body:   {
            holder:   'client/index.html',
            scripts:   'client/index.js'
      }
}
//   layout/simple.meta.js
module.exports   =   {
      head:   {
            title:   'EPII   Avatar',
            metas:   [],
            styles:   'reset.css',
            favico:   'epii-icon.png'
      },
      body:   {
            scripts:   'jquery-2.2.2.min.js'
      }
}