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

coffeecat

v2.1.6

Published

Applet container for NodeJS

Downloads

9

Readme

coffeecat

Build Status

Applet Container for NodeJS

logo

About

CoffeeCat provides a containerized system under Express. Containers are full Express applications which are mounted automatically by the server at start up. CoffeeCat provides the structure for loading apps and associating them with paths. It provides a configuration (JSON) based setup for the Express server.

Installation

On Windows, Linux, and Mac OS the installer creates a new service and starts it.

On Unix:

sudo npm install --global --unsafe git+https://github.com/mlaanderson/coffeecat.git

This installs the configuration file in /etc/coffeecat and sets up a single applet for / in /var/coffeecat. The --unsafe flag allows the installer to create those folders and install the service.

If the npm installation fails for access, install using an npm tarball installation:

sudo npm install --global --unsafe https://github.com/mlaanderson/coffeecat/archive/master.tar.gz

To install a specific release (for example v2.1.0):

sudo npm install --global --unsafe https://github.com/mlaanderson/coffeecat/archive/v2.1.0.tar.gz

On Windows:

npm install --global git+https://github.com/mlaanderson/coffeecat.git

This installs the configuration file in %USERPROFILE%\.coffeecat\conf and a single applet for / in %USERPROFILE%\.coffeecat\applets. And installs the Coffeecat service.

Running

To run coffeecat in a console window, just run coffeecat, it will locate and use its configuration file. On Unix, if it was installed with sudo and you want to run as a normal user, use coffeecat -c /etc/coffeecat/server.json.

Configuration

Configuration is done in a JSON file. The default configuration file location is in conf/server.json. An optional path can be used by using the -c flag on the command line. An applet is defined by it's container (web path) and it's path (file system path). Currently, only HTTP, HTTP/2, and HTTPS protocols, with or without WebSockets, are supported.

{
    "autoLoadApplets": "./applets",
    "applets": [],
    "protocols": [
        {
            "name": "http",
            "port": 8080,
            "listen": "0.0.0.0"
        }, {
            "name": "https",
            "port": 8443,
            "listen": "0.0.0.0",
            "ssl": true,
            "cert": "./encryption/coffeecat.crt",
            "key": "./encryption/coffeecat.key"
        }
    ],
    "errorTemplate": "./conf/errors.ejs"
}

autoLoadApplets

Specifies a file system location from which to automatically add applets to the applets array. Applets are sub directories of this location and are loaded by directory name. That is if there is a directory called hello, the applet there will be mounted at /hello. The only exception to this is a directory called ROOT which will be mounted at the webserver root.

applets

An array of applet definitions.

protocols

Currently supports http and https. Defines the ports to listen on, whether it is encrypted, and whether WebSockets are enabled.

IPv6

To listen on IPv6 addresses along with IPv4 addresses, just duplicate the protocol settings and include an IPv6 address.

{
    "autoLoadApplets": "./applets",
    "applets": [],
    "protocols": [
        {
            "name": "http",
            "port": 8080,
            "listen": "0.0.0.0",
            "websockets": true
        }, {
            "name": "http",
            "port": 8080,
            "listen": "::",
            "websockets": true
        }
    ],
    "errorTemplate": "./conf/errors.ejs"
}

HTTP/2

The built-in http2 module for NodeJS does not work as seamlessly with Express as the spdy library. So install the spdy library:

npm install -s git+https://github.com/spdy-http2/node-spdy.git

HTTP/2 is only supported with modern browsers and only with TLS. For Edge and Internet Exlporer, HTTP/2 is only supported in Windows 10 and higher. For Safari, HTTP/2 is only supported in Mac OS X 10.11 and higher. For further compatibility see the CanIUse page.

Configure the SPDY protocol with SSL, identical to an HTTPS configuration:

{
    "name": "spdy",
    "port": 8443,
    "listen": "0.0.0.0",
    "ssl": true,
    "cert": "./encryption/coffeecat.crt",
    "key": "./encryption/coffeecat.key"
}

In the applet, use the extended features of the HTTP/2 protocol to stream additional resources:

router.get('/', (req, res, next) => {
    var stream = res.push('/main.js', {
        status: 200,
        method: 'GET',
        request: {
            accept: '*/*'
        },
        response: {
            'content-type': 'application/javascript'
        }
    });
    stream.end('alert("Hello from SPDY aka HTTP/2");');
    res.render('index',{}); 
});

Where the index template includes <script src="main.js"></script>