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

tome-server

v2.0.0

Published

Zero dependency web server.

Downloads

10

Readme

Tome

A zero dependency web server.

Navigation

Features

  • Access Logs
  • Cache Control and ETags
  • Compressed File Formats
  • Content Security Policies
  • Custom Errors
  • Direct Link Protection
  • HTTP and HTTPS
  • Memory Cache
  • Pretty URLs
  • Redirects
  • Single and Multiple Domains
  • Static and Streaming Files

Install

Make sure you have Node version 14 or greater. You can check your node version by running node --version.

Install Tome globally as a command line tool, accessible from anywhere.

npm install -g tome-server

If you would rather install Tome with the idea of hacking or developing your own fork, download Tome from GitHub and then run npm link from the Tome folder. You should now be able to run tome from any location and it will always use your latest changes to the codebase.

Quickstart Guide

Tome requires a tome-config.js or tome.js file to tell it what to do. The quickest way to make a config file is the init command.

tome --init

The config file will have a few absolutely necessary items available to edit with other common options commented out in case you ever want to enable those.

At a minimum, you'll want to edit the option.sitePath location to point to a folder where you have HTML and other web files to serve. The path should be absolute or you can use relative paths by using the __dirname environment variable provided by Node.

// macOS and Linux
option.sitePath = __dirname + '/web'

// Windows
option.sitePath = __dirname + '\\web'

Once your config file is saved, run tome to start a web server. Assuming there are no errors, your web site should be available at localhost or whatever other host name you setup that resolves to your own machine.

Advanced Uses

Tome shares its own tome object with every Tome config file and that opens up a lot of possibilities. For example, you can change any code/option.js or code/shared.js setting from your config file without having to touch the original codebase.

How about adding or replacing functions within code/functions.js? Yep.

Want to customize any of the flow functions in code/flow? Want to setup your own flow function to go beyond static file serving and host an API? I ran this very same setup for years in production. Works great and you get to leverage not just everything in Tome but everything in Node too. All within the comfort of your own custom config file.

License

CC0 1.0 Universal

This work has been marked as dedicated to the public domain.