KoaHub平台基于Node.js开发的Koa EJS渲染插件代码信息详情
koa-ejs
ejs render middleware for koa
koa-ejs
Koa ejs view render middleware. support all feature of ejs.
Usage
Example
var koa = require('koa'); var render = require('koa-ejs'); var app = koa(); render(app, { root: path.join(__dirname, 'view'), layout: 'template', viewExt: 'html', cache: false, debug: true }); app.use(function *() { yield this.render('user'); }); app.listen(7001);
Or you can checkout the example.
settings
- root: view root directory.
- layout: global layout file, default is
layout
, setfalse
to disable layout. - viewExt: view file extension (default
html
). - cache: cache compiled templates (default
true
). - debug: debug flag (default
false
). - delimiter: character to use with angle brackets for open / close (default
%
).
Layouts
koa-ejs
supports layouts. The default layout file is layout
. If you want to change default layout file, use settings.layout
. Also you can specify layout byoptions.layout
in yield this.render
. Also you can set layout = false
to disable the layout.
<html> <head> <title>koa ejs</title> </head> <h3>koa ejs</h3> <body> <%- body %> </body> </html>
Inlcude
Supports ejs includes.
State
Support ctx.state
in koa.
Licences
(The MIT License)
Copyright (c) 2014 dead-horse and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
wemall 开源微商城 ,微信商城,商城源码,三级分销,微生鲜,微水果,微外卖,微订餐---专业的o2o系统
wemall地址:http://www.wemallshop.com
代码来源:http://js.koahub.com/home/feature/koa-jwt
KoaHub平台基于Node.js开发的Koa EJS渲染插件代码信息详情的更多相关文章
- KoaHub平台基于Node.js开发的Koa 连接支付宝插件代码信息详情
KoaHub平台基于Node.js开发的Koa 链接支付宝插件代码信息详情 easy-alipay alipay payment & notification APIs easy-alipay ...
- KoaHub平台基于Node.js开发的Koa JWT认证插件代码信息详情
koa-jwt Koa JWT authentication middleware. koa-jwt Koa middleware that validates JSON Web Tokens and ...
- KoaHub平台基于Node.js开发的Koa router路由插件代码信息详情
koa-router Router middleware for koa. Provides RESTful resource routing. koa-router Router mid ...
- KoaHub平台基于Node.js开发的Koa的skip插件代码详情
koahub-skip koahub skip middleware koahub skip Conditionally skip a middleware when a condition is m ...
- KoaHub平台基于Node.js开发的Koa的简单包装到请求库的类似接口
co-request co-request promisify wrapper for request co-request Simple wrapper to the request library ...
- KoaHub平台基于Node.js开发的Koa的调试实用程序
debug small debugging utility debug tiny node.js debugging utility modelled after node core's debugg ...
- KoaHub平台基于Node.js开发的Koa的连接MongoDB插件代码详情
koa-mongo MongoDB middleware for koa, support connection pool. koa-mongo koa-mongo is a mongodb midd ...
- KoaHub平台基于Node.js开发的Koa的rewrite and index support插件代码详情
koa-static-server Static file serving middleware for koa with directory, rewrite and index support k ...
- KoaHub平台基于Node.js开发的Koa的get/set session插件代码详情
koa-session2 Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb ...
随机推荐
- Intent对象详解——使用Intent启动系统组件
Android的应用程序包含三种重要组件:Activity.Service.BroadcastReceiver,应用程序采用一致的方式来启动它们——都是依靠Intent来启动的,Intent就封装了程 ...
- 笔记:Spark简介
Spark简介 [TOC] Spark是什么 Spark是基于内存计算的大数据并行计算框架 Spark是MapReduce的替代方案 Spark与Hadoop Spark是一个计算框架,而Hadoop ...
- 第七届蓝桥杯javaB组真题解析-凑算式(第三题)
题目 /* 凑算式 B DEF A + --- + ------- = 10 C GHI (如果显示有问题,可以参见[图1.jpg]) 这个算式中A~I代表1~9的数字,不同的字母代表不同的数字. 比 ...
- asp.net权限认证:Windows认证
asp.net权限认证系列 asp.net权限认证:Forms认证 asp.net权限认证:HTTP基本认证(http basic) asp.net权限认证:Windows认证 asp.net权限认证 ...
- 基于机器学习的web异常检测
基于机器学习的web异常检测 Web防火墙是信息安全的第一道防线.随着网络技术的快速更新,新的黑客技术也层出不穷,为传统规则防火墙带来了挑战.传统web入侵检测技术通过维护规则集对入侵访问进行拦截.一 ...
- 利用 UltraEdit 重新排版 XML 结构数据
我们在工作常碰到这种情况,通讯数据或文件数据是以 XML 结构形式保存的,但通常 XML 结构比较混乱,不易分析.现在我们利用 UltraEdit32对该类型数据做 Reformat,具体操作如下: ...
- PHP编码规范实例
<?php /** * 符合psr-1,2的编程实例 * * @author 作者 描述 */ namespace Standard; // 顶部命名空间 / ...
- NSMutableAttributedString
开发过程中,经常会遇到动态计算行高的问题, - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)op ...
- self、 superclass 、 super的区别
self. superclass . super self : 当前方法的调用者 class:获取方法调用者的类对象 superclass:获取方法调用者的父类对象 super:不是一个指针,编译指示 ...
- ASP.NET MVC用存储过程批量添加修改数据
用Entity Framework 进行数据库交互,在代码里直接用lamda表达式和linq对数据库操作,中间为程序员省去了数据库访问的代码时间,程序员直接可以专注业务逻辑层的编写.但是对于比较复杂的 ...