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

routerjon

v0.1.12

Published

An nodejs expressjs router, hopefully simple to run with npm scripts. Uses letsencrypt for https encryption.

Downloads

90

Readme

routerjon

an nodejs expressjs router, giving you outward https encryption with certificates issued from letsencrypt.

basically my script i use for https certs on deployment.

install

npm install -g routerjon

setup

mkdir routerjon
cd routerjon
touch config.json

config json should list the different domains you will use. and to which routerjon should redirect them.

for example the config running on my deployment at blogjono.com is

{
  "ports": {
    "http": 80,
    "https": 443
  },
  "production": true, // server for letsencrypt, note production has rate limit
  "email": "[email protected]",
  "router": { // these are servers already running on the machine
    "blogjono.com": {
      ".": 9000,
      "fcc-pin": 9001,
      "booktrade": 9003
    },
    "opentorah.uk": 9002
  }
}

default config

The default config fills in any gaps missed by your config.

{
  "ports": {
    "http": 3000,
    "https": 3443
  },
  "production": false,
  "spdy": false, // option to use an experimental http2 server
  "domains": {
    "localhost:3000": 9000
  }
}

run

[sudo] routerjon ./conifg.json

run (in background)

nohup routerjon ./config.json

run forever

make sure you are in a directory with a file named exactly config.json

when routerjon crashes it will foreverjs process manager will restart it

[sudo] npm i -g forever
touch routerjon_forever

routerjon_forever file

#!/bin/sh
routerjon ./config.json
[sudo] forever start -c bash routerjon-forever

you may need sudo or root privallages to run the command with the server ports 80 and 443. you will also need to stop any other servers (like nginx, apache) listening on these ports

reload changes

by default when you edit the config with valid json and save the file, changes will be automatically reloaded (thanks to node-watch). This makes it easy to vim into and fiddle with the routers port numbers

run into challenges with letsencrypt

this module uses greenlock v3 to manage certificates which stores the files in ~/.config/greenlock. sometimes you may have to delete this folder if you run into errors in the logs.

suggestions ip-tables

so that the nodejs app does not run as root it is suggested to install and use libcap2

sudo pacman -Syu libcap
sudo setcap cap_net_bind_service=+ep `readlink -f \`which node\``

details

the script will store your certificates in the ~/letsencrypt directory.

i am not sure the greenlock-express module causes them to autorenew.

author & licence

author: Jonathan T L Lee

licence: MIT

repo: https://github.com/Lee182/routerjon

feel free look around the code. its only 176 lines