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

rwserve-lorem-ipsum

v1.0.9

Published

RWSERVE plugin to generate a Lorem Ipsum payload

Downloads

26

Readme

Open Source RWSERVE plugin

Lorem Ipsum

Dolor sit amet

Motivation

When developing a new plugin it's necessary to test the working functionality with payloads of various sizes. The data in the payload itself has no particular meaning, only it's presence or absence.

Sometimes these tests work best when the payload is deterministic: where the data and its length are repeatable. Other tests work better when the payload is random in length and value.

This plugin generates a response body either deterministically or randomly based on settings provided in the configuration file, or through query-string variables.

Customization

Classic Lorem Ipsum is the default text for the payload, but custom text can be specified when necessary.

This plugin is open source and can be used as is, or enhanced to provide additional features, such as:

  • Obtaining custom text from data sources on the server.
  • Generating payloads in additional languages. (See ISO-639-3 for "tlh").

Download

The plugin module is available from NPM . Before proceeding, you should already have Node.js and RWSERVE configured and tested.

This module should be installed on your web server in a well-defined place, so that it can be discovered by RWSERVE. The standard place for public domain plugins is /srv/rwserve-plugins.

Configuration is Everything

Make the software available by declaring it in the plugins section of your configuration file. For detailed instructions on how to do this, refer to the plugins documentation on the Read Write Tools HTTP/2 Server website.

TL;DR

The config settings are straightforward:

  • custom-text is the Lorem Ipsum to use in the payload.
  • repeat is the number of times the text should be repeated.
  • randomize is "true" or "false".
  • content-type is the MIME-type identifier to add to the response headers.

When randomize is "false" the same payload is generated each time.

When custom-text is omitted, and randomize is "true" the payload will consist of an arbitrary selection of classic "sentences".

When custom-text is provided, and randomize is "true" the text is split into words and rearranged to provide an arbitrary selection of words.

When content-type is omitted, no "content-type" header is added to the response.

The sample router shown above will route any GET or HEAD request for the virtual resource /lorem-ipsum, to the plugin.

Cookbook

A full configuration file with typical settings for a server running on localhost port 7443, is included in this NPM module at etc/lorem-ipsum-config. To use this configuration file, adjust these variables if they don't match your server setup:

Runtime overrides

Sometimes it is desirable to override the settings provided in the configuration file on a request-by-request basis. This can be done by providing the values as query string variables. To do this, use the identical names as above, being sure to urlencode the custom text. For example:

Deployment

Once you've tested the plugin and are ready to go live, adjust your production web server's configuration in /etc/rwserve/rwserve.conf and restart it using systemd . . .

. . . then monitor its request/response activity with journald.

Prerequisites

This is a plugin for the Read Write Tools HTTP/2 Server, which works on Linux platforms.

Review

License

The rwserve-lorem-ipsum plugin is licensed under the MIT License.

Availability