
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
koa-chrome-render
Advanced tools
chrome-render middleware for koa.
Modern web app use technique like react.js vue.js which render html in browser, this cause some problem like search engine can't crawl your page content or first screen slow on low performance device.
This project want to solve this kind of problem in a general-purpose way which use headless chrome to render page result then return to client.
npm i koa-chrome-render
then use it:
const Koa = require('koa');
const chromeRenderMiddleware = require('koa-chrome-render');
const app = new Koa();
app.use(chromeRenderMiddleware({
enable: true,
render: {
// use `window.isPageReady=1` to notify chrome-render page has ready
useReady: true,
}
}));
app.listen(3000);
you can download and run this complete demo which will use chrome-render for mobile device else return html direct.
enable optionsshould enable this middleware for every single request ? it's type can be boolean or function. if type is function, result = enable(request); this can be used to control whether use chrome to render in some case, e.g koa-seo.
render optionsoptions come form chrome-render
maxTab: number max tab chrome will open to render pages, default is no limit, maxTab used to avoid open to many tab lead to chrome crash. ChromeRender will create a tab poll to reuse tab for performance improve and resource reduce as open and close tab in chrome require time, like database connection poll.renderTimeout: number in ms, chromeRender.render() will throw error if html string can't be resolved after renderTimeout, default is 5000ms.useReady: boolean whether use window.isPageReady=1 to notify chrome-render page has ready. default is false chrome-render use domContentEventFired as page has ready.script: string is an option param. inject script source to evaluate when page on loadalso koa-chrome-render will read:
headers from request HTTP headers and attach to chrome-render's requestcookies from request HTTP headers and attach to chrome-render's requestFAQs
chrome-render middleware for koa
The npm package koa-chrome-render receives a total of 7 weekly downloads. As such, koa-chrome-render popularity was classified as not popular.
We found that koa-chrome-render 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.