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

@superbalist/js-pubsub-rest-proxy

v1.2.2

Published

An HTTP server which acts as a gateway for publishing messages via a js-pubsub adapter

Downloads

4

Readme

js-pubsub-rest-proxy

An HTTP server which acts as a gateway for publishing messages via a js-pubsub adapter.

Author Software License NPM Version NPM Downloads

This service wraps the js-pubsub-manager library which bundles support for the following adapters:

  • Local
  • /dev/null
  • Redis
  • Google Cloud

It exposes a /messages/(channel) end-point where messages can be POSTed to.

eg:

POST /messages/test HTTP/1.1
Content-Type: application/json

{
	"messages": [
		"Hello World",
		{
			"another": "message"
		}
	]
}

This is an async end-point which queues messages for background publishing.

The js-pubsub-http adapter is a client-side implementation for publishing messages via this service.

Installation

The service is available as a docker image OR an npm package.

npm install @superbalist/js-pubsub-rest-proxy

Environment Variables

When you start the js-pubsub-rest-proxy image, you can adjust the configuration of the instance by passing one or more environment variables on the docker run command line.

| Env Var | Default | Description | |--------------------------------|-----------|--------------------------------------------------------------------| | PORT | 3000 | The port the web server will listen on | | LOG_LEVEL | info | The log level (silly, debug, verbose, info, warn, error) | | SENTRY_DSN | null | | | MAX_POST_SIZE | 10mb | The max post size for request payloads | | PUBSUB_CONNECTION | redis | The pub/sub connection to use (/dev/null, local, redis, gcloud) | | REDIS_HOST | localhost | | | REDIS_PORT | 6379 | | | GOOGLE_CLOUD_PROJECT_ID | null | | | GOOGLE_APPLICATION_CREDENTIALS | null | The full path to the file containing the Google Cloud credentials | | GOOGLE_CLOUD_CLIENT_IDENTIFIER | null | The client identifier used when talking to Google Cloud | | VALIDATION_ERROR_SCHEMA_URL | false | The url for invalid event schema below. Enables validation | | VALIDATION_ERROR_CHANNEL | validation_error | The channel to publish validation errors to | | PUBLISH_INVALID | true | Publish invalid events (true, false) | | RABBITMQ_FALLBACK | false | Whether the fallback should be used or now (true, false) | | RABBITMQ_URL | pubsub-rest-proxy-rabbitmq| Url with rabbitmq fallback | | RABBITMQ_USER | guest | Rabbitmq user | | RABBITMQ_PASSWORD | guest | Should be a base64 encoded string (guest == Z3Vlc3Q=) |

Running

  1. Start a container using the Redis Pub/Sub adapter
$ docker run \
  -d \
  --rm \
  --name js-pubsub-rest-proxy \
  -e PUBSUB_CONNECTION='redis' \
  -e REDIS_HOST='127.0.0.1' \
  -e REDIS_PORT='6379' \
  superbalist/js-pubsub-rest-proxy
  1. Start a container using the Google Cloud Pub/Sub adapter
$ docker run \
  -d \
  --rm \
  --name js-pubsub-rest-proxy \
  -e PUBSUB_CONNECTION='gcloud' \
  -e GOOGLE_CLOUD_PROJECT_ID='your-project-id-here' \
  -e GOOGLE_APPLICATION_CREDENTIALS='/etc/gcloud_credentials.json' \
  superbalist/js-pubsub-rest-proxy

Validation Error Schema

"properties": {
  "schema": {
      "type": "string",
      "format": "uri"
  },
  "meta": {
      "type": "object"
  },
  "event": {
      "type": "object"
  },
  "errors": {
      "type": "array"
  }
}