
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
A Koa middleware for Nunjucks. Koa2 的一个 Nunjucks 的中间件。
npm install koa-njk
const koaNjk = require('koa-njk');
app.use(
/**
* nunjucks 中间件
*
* @param {string} path 模板根目录路径。root directory of views.
* @param {string} [ext='.html'] 模板扩展名。extension of views'.
* @param {any} [config={}] nunjucks 配置. Nunjucks' config.
* @param {Function} [fn=env => {}] 对于 Environment 的自定义扩展回调。extension callback to Environment instance.
* @returns {Function}
*/
koaNjk(path.join(__dirname, 'views'), '.html', {
autoescape: true,
...
}, env => {
// add filters and extensions here
})
);
app.use(async (ctx) => {
/**
* Renders the template with the optional context hash.
* 使用数据渲染模板。
*
* @param {string} view name of a template. 模板的名称。
* @param {any} [context] data in tpl. 模板使用的数据。
*/
await ctx.render('index', {title: 'koa-njk'});
});
FAQs
A Koa middleware for Nunjucks
The npm package koa-njk receives a total of 14 weekly downloads. As such, koa-njk popularity was classified as not popular.
We found that koa-njk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.