Gathering detailed insights and metrics for kne-egg-view-ejs
Gathering detailed insights and metrics for kne-egg-view-ejs
Gathering detailed insights and metrics for kne-egg-view-ejs
Gathering detailed insights and metrics for kne-egg-view-ejs
npm install kne-egg-view-ejs
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
64 Stars
19 Commits
10 Forks
11 Watchers
3 Branches
26 Contributors
Updated on Jul 03, 2024
Latest Version
0.0.4
Package Id
kne-egg-view-ejs@0.0.4
Unpacked Size
11.21 kB
Size
3.95 kB
File Count
8
NPM Version
6.14.4
Node Version
12.16.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
egg view plugin for ejs.
English | 简体中文
1$ npm i kne-egg-view-ejs --save
1// {app_root}/config/plugin.js 2exports.ejs = { 3 enable: true, 4 package: 'egg-view-ejs', 5}; 6 7// {app_root}/config/config.default.js 8exports.view = { 9 mapping: { 10 '.ejs': 'ejs', 11 }, 12}; 13 14// ejs config 15exports.ejs = {};
Create a ejs file
1// app/view/hello.ejs 2hello <%= data %>
Render it
1// app/controller/render.js 2exports.ejs = async ctx => { 3 await ctx.render('hello.ejs', { 4 data: 'world', 5 }); 6};
The file will be compiled and cached, you can change config.ejs.cache = false
to disable cache, it's disable in local env by default.
You can include both relative and absolute file.
Relative file is resolve from current file path.
1// app/view/a.ejs include app/view/b.ejs 2<% include b.ejs %>
Absolute file is resolve from app/view
.
1// app/view/home.ejs include app/view/partial/menu.ejs 2<% include /partial/menu.ejs %>
You can render a view with layout also:
1// app/view/layout.ejs 2 3<%- body%> 4 5// app/controller/render.js 6exports.ejs = async ctx => { 7 const locals = { 8 data: 'world', 9 }; 10 11 const viewOptions = { 12 layout: 'layout.ejs' 13 }; 14 15 await ctx.render('hello.ejs', locals, viewOptions); 16};
use callback
1// app/view/layout.ejs 2 3<%- body%> 4 5// app/controller/render.js 6exports.ejs = async ctx => { 7 8 await ctx.render('config.ejs', argss, { 9 layout: 'layout.ejs', 10 fn: (html) => { 11 return jwt.sign(JSON.parse('{' + html + '}'), cfgSignatureSecret, { expiresIn: cfgSignatureSecretExpiresIn }); 12 } 13 }); 14};
see config/config.default.js for more detail.
Please open an issue here.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 10/18 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More