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

daveappserver

v0.7.15

Published

Factored code that was appearing in all my servers.

Downloads

844

Readme

appserver

A new release of nodeStorage that removes all the historical addons, streamlines configuration, only serves from the local file system, and serves the home page of the app. It could be thought of as v2.0 of nodeStorage except it is not backward compatible.

Overview

Over the years nodeStorage got a lot of appendages and add-ons that most apps don't use.

The configuration file was confusing and not well documented.

It was one of the first things I wrote for Node, and I learned a lot over time.

FInally when one of my programming partners had difficulty understanding the code, I realizaed I did too, and decided to rebuild it from scratch using components I had already developed, such as davehttp, davetwitter, etc.

I have converted Little Outliner to use this backend. The app was only modified in how it's configured. Everything else remains the same. It uses the same api glue file that it used to access nodeStorage.

Configuring

Below is an example of config.json file that goes in the same directory as the appserver.js file.

Example

{
	"productName": "littleOutliner",
	"productNameForDisplay": "Little Outliner",
	"urlServerHomePageSource": "http://littleoutliner.com/testing/1.9.0/index.html",
	"prefsPath": "outlinerPrefs.json",
	"docsPath": "myOutlines/",
	
	"port": 1962,
	"flWebsocketEnabled": true,
	"websocketPort": 1963,
	"myDomain": "test.littleoutliner.com",
	
	"twitterConsumerKey": "1234567890123456789012345",
	"twitterConsumerSecret": "12345678901234567890123456789012345678901234567890"
	}

Explanation

The first section provides configuration information about and to the app that's running on the server's home page.

  1. productName is an id that can be used to identify the product. No specified use.

  2. productNameForDisplay is what the app should use in its user interface.

  3. urlServerHomePageSource is the address of an HTML page that is served through the home page of the server. It can contain macros that plug in values from the server.

  4. prefsPath is the name of the prefs file for the app. This is the file you should read and save to, to maintain the state of the app for the user.

  5. docsPath is where the documents for this app are stored in the user's storage on the server.

  6. urlServerForClient is the address the app uses to call back to the server.

  7. urlWebsocketServerForClient is the address of the web socket that reports on changes to files stored on the server. This address can be included in the app files so that apps that read the files can subbscribe to changes.

The second section configures the HTTP server and the connection to Twitter for identity.

  1. port is the port the HTTP server will run on, unless process.env.PORT is specified. It overrides the port choice in the config file.

  2. flWebsocketEnabled, a boolean, determines whether or not we initialize the websocket server, if it's true then websocketPort is the port it's listening on.

  3. myDomain, the domain assigned to this app. It's the domain you'd use to access the home page. If that includes a port, include the port in this value.

  4. twitterConsumerKey and twitterConsumerSecret are the values that identify the app for Twitter, as assigned on developer.twitter.com.

Updates

v0.5.48 -- 3/18/22 by DW

Exports three routines: fileExists, readWholeFile, writeWholeFile.

v0.5.44 -- 3/18/22 by DW

New callback, config.publishFile. If defined we call back with the file, screenname, relpath, flprivate, filetext and the url of the file if it's public.

It's called when we handle a /publishfile or /writewholefile message.

v0.5.32 -- 12/4/21 by DW

Added a new callback, publicFileSaved, which is called when the user updates a public file.

Fixed a bug where a user couldn't create a new file if their public files folder was empty.

v0.5.32 -- 9/26/21 by DW

Fixed the example app to require "../appserver.js" instead of "lib/daveappserver.js" which only exists on my development machine.

v0.5.31 -- 9/15/21 by DW

writeWholeFile was meant to be sure the path to the file exists before writing the file. It wasn't doing it, now it does.