Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
express-middleware-seo
Advanced tools
express middleware for serving prerendered javascript-rendered pages for SEO
SEO middleware for express base on chrome-render, a substitute for prerender.
Modern web app use technique like react.js vue.js which render html in browser, this lead to search engine can't crawl your page content.
This project want to solve this kind of problem in a general-purpose way, it detect request is from search engine crawler then use headless chrome to render out your modern web page and return to crawler.
Here is express-middleware-seo's architecture diagram:
npm i express-middleware-seo
then use it:
const express = require('express')
const path = require('path')
const app = express()
const { seoMiddleware } = require('express-middleware-seo')
app.use(
seoMiddleware({
enable: true,
render: {
useReady: true,
renderTimeout: 10000
}
})
)
app.use(express.static(__dirname + '/static'))
app.listen(3000)
you can download and run this complete demo
You should install Chrome 59+ in your servers before you use this middleware
options 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 loadFAQs
express middleware for serving prerendered javascript-rendered pages for SEO
The npm package express-middleware-seo receives a total of 0 weekly downloads. As such, express-middleware-seo popularity was classified as not popular.
We found that express-middleware-seo 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.