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 🙏

© 2025 – Pkg Stats / Ryan Hefner

spa-seo

v0.0.3

Published

Single Page App SER

Readme

#spa-seo (parameter validation set) 싱글페이지 어플리케이션에서 SEO에 대한 이슈를 처리하기 위해 많들었습니다. bot이 접속을 하면 웹서버에서 체크를 한 후 프록시 서버로 연결해주는 방식을 체택했습니다.

##사용 모듈

  1. phantomjs-prebuilt : https://github.com/Medium/phantomjs

##설치

  1. spa-seo 설치
$ npm install spa-seo
  1. CentOs
$ sudo yum install fontconfig
  1. Ubuntu
$ sudo apt-get install libfontconfig

##설명 1. Bot 접속 2. Nginx혹은 apache에서 bot인지 체크 후 Seo Server 연결 3. 해당 url이 html 파일로 있을시, html 파일 리턴, 없을시 팬텀Js를 이용하여 리턴 및 파일 생성

##생성된 html 초기화 등록된(저장된) html 디렉토리를 삭제해주시면 됩니다. 초만간 일자별로 삭제 하는걸 추가해 놓겠습니다.

##설정 ####1. Paramter | 구분 | 설명 | 비고| |-------|---|-----------| | PORT | SEO 서버를 띄우기 위한 포트 | Default: 9999 | | fileDirectory | html파일을 저장하기 위한 디렉토리 | Default: ./files |

####2. Nginx 설정

server {
	...
    location / {
    	set $rot 0;
    	if ($http_user_agent ~* "Googlebot|cowbot|yeti|empas|MSNBot|daumoa|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator") {
            set $rot 1;
        }
         if ($args ~ "_escaped_fragment_") {
            set $rot 1;
        }

		# rot 일때
        if ($rot = 1) {
        	proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            # 아래의 것을 안넣어주면 기본 protocol을 http로 설정됩니다.
            proxy_set_header X-Forwarded-Proto $scheme;

            proxy_pass http://localhost:9999/;
        }
        # rot이 아닐시
        if ($rot = 0) {
        	...
        }
        ...
    }
    ...
}

####3. Apache 설정 제가 Apache를 사용안해서 아직 알아보지 못했습니다.

####4. Html 설정 안에 아래의 태그를 넣어주세요.

<meta name="fragment" content="!">

##사용

  1. server.js 만들기
	const Spaseo = require('spa-seo');

    const spaseo = new Spaseo(/*PORT*/, /*File_Directory*/);
    spaseo.startServer();
  1. pm2 혹은 forever 등록
pm2 start server.js
or
forever start server.js