【文件属性】:
文件名称:polka-ejs:在Polka中使用ejs模板引擎
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-01 11:06:24
JavaScript
波尔卡EJS
向添加了模板引擎支持
安装
npm install polka-ejs
用法
const polka = require ( "polka" ) ;
const ejs = require ( "polka-ejs" ) ;
const app = polka ( ) ;
app . use ( ejs ( ) ) ;
app . get ( "/" , ( req , res ) => {
res . render ( "index.ejs" , { number : 5 } ) ;
} ) ;
app . listen ( 3000 ) ;
使用以下views/index.ejs创建一个views/index.ejs
< html >
< body >
< h1> The Number is < %= number % > h1>
</
【文件预览】:
polka-ejs-master
----index.js(2KB)
----package.json(629B)
----.eslintrc.json(835B)
----LICENSE(1KB)
----package-lock.json(347B)
----.npmignore(28B)
----.gitignore(13B)
----README.md(1KB)