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

stream-statics

v0.6.1

Published

Development server for testing and demonstrating front-end projects.

Downloads

169

Readme

stream-statics

Lightweight webserver for testing and demonstrating front-end projects, running HTTP, HTTPS or HTTP/2. A command to terminate the server is included.

Mime types

A limited set of common mime-types is used. When you install the mime-types package next to stream-statics all known mime-types can be used. This way the number of dependencies is limited.

Configuration

Before setting up a new server, a few checks are made. When the port number is in use or when the root folder can't be found, the startServer function will error.

Secure serving

On first secure run, or when the certificate has expired, a private key and a certificate are generated inside the module folder

Usage

Default configuration:

root: './',
protocol: 'http2', // 'http' | 'https' | 'http2'
port: 9630,

Start a server for instance before starting a e2e test

"scripts": {
    "...": "...",
    "pretest": "stst --port 3001 --protocol http",
    "...": "..."
    "posttest": "ststop --port 3001",
    "...": "..."
}

On the command line, with short argument syntax:

npx stst --https --4210 --../../yourProject
...
npx ststop --4210

In a script:

import { startServer } from 'stream-statics'

const config = {
    root: './', // default folderName
    protocol: 'http2', // default protocol
    port: 9630, // default portNumber
}
const server = await startServer(config) // argument is required for now.
...
const callback = () => console.log(`Connection to localhost:${config.port} was closed`)
server.close(callback)

Protocol Problems

The browser can display various intermediate notification pages. Protocol problems can display the following message, or similar:

The connection was reset

You are browsing a https served page with a http url.

Secure Connection Failed

You are browsing a http served page with a https url.

Warning: Potential Security Risk Ahead

You are serving https or http2 which is using the internal self-signed certificate. On the internet that poses a security threat. To test your secure serving needs, click the appropriate buttons to continue for advanced users.

Demo

Happy flow:

./demo.sh

Support for serving non-html index files, Circumventing errors for missing favicon.ico, Serving with a secure protocol using a self-signed certificate:

./demo-alt.sh