npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ssr-proxy-puppeteer

v1.0.11

Published

Make SEO easy for legacy SPA | 让单页应用SEO更简单

Downloads

12

Readme

ssr-proxy-puppeteer

Make SEO easy for legacy SPA | 让单页应用SEO更简单

usage | 使用

install | 安装

npm i ssr-proxy-puppeteer -g
# when it fails try this, refer https://github.com/GoogleChrome/puppeteer/issues/375 | 如果安装失败,使用下面命令,原因参考左侧连接
npm i ssr-proxy-puppeteer -g --unsafe-perm=true

use | 使用

ssr-proxy-puppeteer --origin=http://localhost:3001
# or more detailed config | 或者更详细的配置 
ssr-proxy-puppeteer --config=config.js

examples | 例子

config | 配置

simple config | 简单版

  "ssr": {
    "origin": "http://jilupian.youku.com"
  }

more detail config version | 复杂版

module.exports = {
  // config for ssr
  ssr: {
    origin: "http://localhost:8080", // string, the source to proxy from | 源网站
    port: 3002, // port for this server | 此应用服务端口
    timeout: 10000, // in miliseconds, time to wait for puppeteer ssr | 等待puppeteer服务端渲染的时间(毫秒)
    ttl: 86400, //cache, inseconds| 缓存时间,秒
    
    // if need modify (like js contain original host urls) | 判断哪些请求需要额外修改body的
    bodyNeedModify: function (origin, req, res, proxyRes) {
      ...
      // return boolean
    },
    // how the body modified (rewrite urls) | body 如何修改 
    bodyModifier: function (body, origin, req, res, proxyRes) {
      ...
      // return string
    },
  },
  // config for cache refer https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegotourl-options | 缓存配置
  cache: {
    //`cache-manager-redis` and `cache-manager-memcached-store` already installed 
    // and can be used as `store` option, by default `store` uses `memory`
    store: "cache-manager-redis",

    // other options for your store type
    // refer https://github.com/dial-once/node-cache-manager-redis or https://github.com/theogravity/node-cache-manager-memcached-store
    db: 2
  },
  // launch config for puppeteer | puppeteer启动选项配置
  // refer https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
  puppeteer: {}
}

for default config refer: src/default-config.js

docker

docker pull postor/ssr-proxy-puppeteer
docker run -p 3003:3000 -it --rm postor/ssr-proxy-puppeteer ssr-proxy-puppeteer --origin=http://192.168.1.10:8080