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

pfapi-tester

v1.0.3

Published

a command line tester for strapi-plugin pfapi

Downloads

1

Readme

pfapi-tester

a command line tester for strapi-plugin pfapi

how to install

npm install pfapi-tester -g

get help and demo run

> pfapi-tester -h

Usage: pfapi-tester [OPTIONS]...

cli to test strapi plugin pfapi

Options:
  -V, --version         output the version number
  -b, --base_url <url>  base url (default: "http://localhost:1337")
  -p, --path <path>     url path & query string (default: "/pfapi/pf/northern-cities")
  -k, --api_key <key>   pfapi api key (default: "Pfapi-Demo")
  -c, --concurrent      run concurrently
  -f, --fetch_items     fetch each item if there items in response
  -w, --walk_through    walk through all pages
  -t, --times <3>       run how many times (default: "3")
  -d, --delay <ms>      simulate delay within api
  -g, --etag            send if-none-match with etag
  -e, --expires         send if-modified-since with expires
  -s, --sleep <ms>      sleep for ms after each request
  -r, --ss_rand         disable server caches on each request
  -l, --legend          print legend of stats
  -v, --verbose         print verbose details
  -h, --help            display help for command

> pfapi-tester -p /pfapi/pf/northern-cities -t 10 -l

++++++++++
{
  base_url: '...',
  path: '/pfapi/pf/northern-cities',
  times: 10,
  legend: true
}
total: 10 ok: 10 not_ok: 0
------------------------------
   	pfapi	http	total
------------------------------
ave	1.96	3.01	132.06
min	0.85	1.68	98.85
max	10.56	11.54	176.20
------------------------------
all values are in milliseconds.
pfapi: time used by pfapi.
http: time used by http server.
total: round-trip delay + http.

p_response_time: pfapi response time in ms.

x_response_time: strapi response time in ms.

total_time: total time used for the http request in ms.

.env

setup .env in you work directory can save put into option -b and -k, on each run.

BASE_URL=http://localhost:1337
API_KEY=Pfapi-Demo-XXXXXX

x-response-time

setup strapi to send x-response-time in the response headers:

yarn add koa-response-time

add following code in file src/index.js

...
const responseTime = require('koa-response-time');

module.exports = {
...
  bootstrap({ strapi }) {
    strapi.server.app.use(responseTime({ hrtime: true }));
  },
};