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

@boomerang-io/webapp-spa-server

v1.3.2

Published

Webapp Server for React-based SPA w/ client-side routing

Downloads

521

Readme

Webapp SPA Server

Provide a consistent way to deploy Boomerang React SPAs with client-side routing into an IBM Cloud Private environment.

Features

  • Serve static assets
  • Client-side routing support for SPAs
  • Dynamic data and script injection into HTML document at run-time
  • Logging with @boomerang-io/logger-middleware
  • Cloud native health checking with Cloud Native Health Connect
  • New Relic monitoring
  • Instana monitoring
  • Google Analytics
  • BeeHeard survey

Design

The server can be invoked via a command line or imported as a configurable function to be executed.

  • CLI - for easy stand alone use that can be invoked via a script e.g. in npm scripts
  • Function - create server and run it within a node.js file

CLI

The server can be run via the CLI interface with configuration pass as options.

Enter the following to see the manual

boomerang-webapp-server --help

Command

boomerang-webapp-server serve

Options

| Option | Alias | Description | | :-------------------------- | :-------: | :----------------------------------------------------------------------------------------------- | | --cors | -c | CORS configuration using cors package. Accepts JSON string | | --disableInjectHTMLHeadData | -d | Toggle whether the app needs to inject data into the header. Defaults to false | | --dotenvFilePath | -p | Path to local .env file to read in. Useful for local testing |

Use as a function

const server = require("@boomerang-io/webapp-spa-server");
server({
  cors: {},
  disableInjectHTMLHeadData: true,
});

Environment Variables

The following env variables are assumed to exist either from a local .env file or passed in to the container at runtime. If nothing is passed it, it will default to the following:

| Variable | Purpose | Type | | :--------------------------: | :-----------------------------------------------------------------------: | :------------------: | | APP_ROOT | Root context of the application | string | | BUILD_DIR | directory relative to the exeuction where app files are located | string | | PORT | Port for server to run on | number | | HTML_HEAD_INJECTED_DATA_KEYS | Environment variables to inject into the HTML document | comma delimited list | | HTML_HEAD_INJECTED_SCRIPTS | Scripts to inject into HTML document. Files need to be in the BUILD_DIR | comma delimited list | | NEW_RELIC_APP_NAME | App name for New Relic monitoring | string | | NEW_RELIC_LICENSE_KEY | License key for New Relic monitoring | string | | INSTANA_REPORTING_URL | Reporting URL for Instana monitoring | string | | INSTANA_KEY | License key for Instana monitoring | string | | GA_SITE_ID | Site ID for Goolge Analytics | string | | ENABLE_BEEHEARD_SURVEY | Enable BeeHeard survey | boolean |

Defaults

Some of the values, both config and environment variables have defaults in the server for deploying to the IBM Consulting Essentials platform.

APP_ROOT

  • "/"

BUILD_DIR

  • "build"

CORS

{
  "origin": "*",
  "allowedHeaders": "Content-Type, Authorization, Content-Length, X-Requested-With",
  "methods": "DELETE,GET,OPTIONS,PATCH,POST,PUT"
}

HTML_HEAD_INJECTED_DATA_KEYS

  • APP_ROOT
  • BASE_APPS_ENV_URL
  • BASE_LAUNCH_ENV_URL
  • BASE_SERVICE_ENV_URL
  • BASE_WWW_ENV_URL
  • CORE_APPS_ENV_URL
  • CORE_ENV_URL
  • CORE_SERVICE_ENV_URL
  • PRODUCT_APPS_ENV_URL
  • PRODUCT_ENV_URL
  • PRODUCT_SERVICE_ENV_URL

PORT

  • 3000