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

sample-pilet-service

v1.8.0-pre.20240917.2

Published

Piral: Sample pilet feed service.

Downloads

120

Readme

Piral Logo

Sample Pilet Feed · Build Status GitHub License GitHub Tag Gitter Chat

A simple Node.js sample pilet feed service for use with Piral. If you don't want to play around with a feed service locally then use the (free) community edition of the official Piral Feed Service. Alternatively, if you are interested in more beef such as running the official Piral Feed Service in your environment or accessing premium features in the online edition then have a look at Piral Cloud website.

Getting Started

For running this sample locally all you need to do is running:

npm i && npm start

Remark: This sample requires Node.js and NPM. The used port is 9000, which could be re-configured easily (e.g., via an environment variable PORT).

Auth Keys

For publishing a Pilet a handful premade keys have been added (file: src/auth/keys.ts):

df133a512569cbc85f69788d1b7ff5a909f6bcfe1c9a2794283a2fc35175882c
da91e6a8aeee998b7d6b0701486e4909d2ee14fbcc0af5de601c1d09982141d5
f94fa7067e0299679af2b1dda6f1835cd7ed03a43c104446954b11ec7b1509d0
edf8c9275873ca743394b3367e67149d6fda5306b577113fbf1ff4f191de69e4
ad647bdc23b7437b8fa8f27c3e2d3f70fbb493c53e9160e07d37a98df333b188

Either change the file when using this service in any non-local infrastructure or set the environment variable PILET_API_KEYS with comma separated values (e.g., A,B,C uses three keys A, B, and C instead).

Pilet Database

For this simple sample everything is kept in memory. If you want to change this behavior to store the pilets also in a database / some storage you will need to modify the src/db/index.ts file.

Remark: The file has been prepared in such a sense that all exposed functions already return promises.

Reported URL

For the pilets the reported URL is http://localhost/... unless changed via src/constants.ts. For simplicity, a resolution algorithm based on standard environment variables is already active.

| Variable | Meaning | |------------------------|---------------------------------------------------------------------------------| | WEBSITE_HOSTNAME | The name of the host, e.g., localhost | | PORT | The port, otherwise falling back to 9000 | | HTTPS | Is HTTPS active, otherwise falling back to HTTP | | PILETS_SNAPSHOT | Defines the path of the database snapshot directory | | HTTP_X_FORWARDED_PROTO | The used protocol (e.g., http), otherwise falling back to the HTTPS setting |

Snapshot

By default, the service creates a directory called pilets in the current working directory. If you don't want this (i.e., no snapshot should be created) then set the PILETS_SNAPSHOT environment variable to an empty string i.e., PILETS_SNAPSHOT="". Otherwise, if you want to use another directory, set the variable to a directory, e.g., PILETS_SNAPSHOT=/tmp/pilets.

Usage via NPM

Alternatively, if you want to use the service only locally to play around you can also install and run the package via NPM:

npx sample-pilet-service

You could also install it globally:

npm i sample-pilet-service -g

This will enable a new command sample-pilet-service to be invoked on the command line shell.

License

Piral is released using the MIT license. For more information see the license file.