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

retold-harness

v1.0.4

Published

Restful API harness. Serves on 8086.

Downloads

16

Readme

Retold Harness

A basic set of API endpoints that contains Books, Authors, Joins and links to images for the cover of each book. Useful for more complex harnesses.

Entirely self-contained.

Getting up and Running

This package requires Docker to be installed on your workstation. You can get things running by typing the following commands:

1) Clone the code from github:

git clone https://github.com/stevenvelozo/retold-harness

2) Build the docker image:

This can take a bit of time, depending on your connection speed and resources.

npm run docker-dev-build

Building the docker image

3) Create and launch the docker container:

This can also take a bit of time.....

npm run docker-dev-run

Launching the docker container

The launched container in the Docker UI

After the docker container is running there is quite a bit available:

  • a REST web API serving JSON on port 8086
  • a browser-based visual studio code environment ready to run node applications
  • a mariadb instance, preloaded with 10,000 Book records joined to their Author records
  • a partridge
  • a pear tree

This all fits in less than 500 meg of RAM, and uses virtually no processor power

Docker statistics after a few minutes of running

Some REST API Examples

The REST endpoints are provided by the meadow-endpoints library on NPM. Some examples of queries you can make:

List the first 100 Books in the database: (http://localhost:8086/1.0/Books/0/100)

The first 100 Books

Get the book with IDBook 1: (http://localhost:8086/1.0/Book/1)

You will notice that when requesting a single book, there is an Authors array populated with the connected authors for the particular book. But in the list, the array was not filled out. This is because in meadow-endpoints there is a post-operation behavior hook only attached to the read single record endpoint. This is reflected in the /source/Retold-Harness.js code file in lines 14-41.

Book 1

List the first 10 Authors in the database whose name begins with Susan: (http://localhost:8086/1.0/Authors/FilteredTo/FBV~Name~LK~Susan%25/0/10)

The first 10 Susans

Luxury Code

Luxury code is a set of tools to provide easy debugging and test running regardless of environment. These tools leverage the code-server browser implementation of the Visual Studio Code editor. The first time you launch the browser editor, you will be asked for a password. The password is: luxury

Launching Luxury Code requires a Password: luxury

Visual Studio Code Editor with Config and Source

MySQL

The docker image also exposes a MySQL server (it's actually MariaDB but nobody is the wiser). You can connect to and query this database directly from your tool of choice or other applications. The user is: root, the port is 3306 and the password is: 123456789

MySQL Connection Info

MySQL Query

Customizing your Environment

If you dislike the ports, passwords or anything else about this configuration all the code is readily available. In the package.json file, the two convenience docker spin-up commands are there. This is where you would change the port mapping for the API server, SQL server and other services. Remember.... you broke it, you bought it.