1.3.2 • Published 7 months ago

@boomerang-io/webapp-spa-server v1.3.2

Weekly downloads
27
License
Apache-2.0
Repository
github
Last release
7 months ago

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

OptionAliasDescription
--cors-cCORS configuration using cors package. Accepts JSON string
--disableInjectHTMLHeadData-dToggle whether the app needs to inject data into the header. Defaults to false
--dotenvFilePath-pPath 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:

VariablePurposeType
APP_ROOTRoot context of the applicationstring
BUILD_DIRdirectory relative to the exeuction where app files are locatedstring
PORTPort for server to run onnumber
HTML_HEAD_INJECTED_DATA_KEYSEnvironment variables to inject into the HTML documentcomma delimited list
HTML_HEAD_INJECTED_SCRIPTSScripts to inject into HTML document. Files need to be in the BUILD_DIRcomma delimited list
NEW_RELIC_APP_NAMEApp name for New Relic monitoringstring
NEW_RELIC_LICENSE_KEYLicense key for New Relic monitoringstring
INSTANA_REPORTING_URLReporting URL for Instana monitoringstring
INSTANA_KEYLicense key for Instana monitoringstring
GA_SITE_IDSite ID for Goolge Analyticsstring
ENABLE_BEEHEARD_SURVEYEnable BeeHeard surveyboolean

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
1.3.2

7 months ago

1.3.1

9 months ago

1.3.1-beta.1

9 months ago

1.3.1-beta.0

9 months ago

1.3.1-beta.2

9 months ago

1.3.0-beta.11

1 year ago

1.3.0-beta.10

1 year ago

1.3.0-beta.6

1 year ago

1.3.0-beta.7

1 year ago

1.3.0-beta.8

1 year ago

1.3.0-beta.9

1 year ago

1.3.0-beta.5

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.3.0-beta.3

1 year ago

1.3.0-beta.4

1 year ago

1.3.0-beta.1

1 year ago

1.3.0-beta.2

1 year ago

1.3.0-beta.0

1 year ago

1.2.3

1 year ago

1.2.3-beta.1

1 year ago

1.2.3-beta.2

1 year ago

1.2.2-beta.0

1 year ago

1.2.3-beta.0

1 year ago

1.2.2

2 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.2.1-beta.0

3 years ago

1.2.0-beta.0

3 years ago

1.1.1-beta.1

3 years ago

0.0.12-beta.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

0.0.12-beta.1

3 years ago

1.0.0

3 years ago

1.0.2-beta.2

3 years ago

1.0.2-beta.3

3 years ago

1.0.2-beta.0

3 years ago

1.0.1-beta.0

3 years ago

1.0.2-beta.1

3 years ago

1.0.0-beta.0

3 years ago

1.1.0-beta.1

3 years ago

1.1.0-beta.0

3 years ago

0.0.11-beta.19

4 years ago

0.0.11-beta.18

4 years ago

0.0.11-beta.17

4 years ago

0.0.11-beta.16

4 years ago

0.0.11-beta.15

4 years ago

0.0.11-beta.14

4 years ago

0.0.11-beta.13

4 years ago

0.0.11-beta.12

4 years ago

0.0.11-beta.11

4 years ago

0.0.11-beta.10

4 years ago

0.0.11-beta.8

4 years ago

0.0.11-beta.7

4 years ago

0.0.11-beta.9

4 years ago

0.0.11-beta.4

4 years ago

0.0.11-beta.3

4 years ago

0.0.11-beta.2

4 years ago

0.0.11-beta.6

4 years ago

0.0.11-beta.5

4 years ago

0.0.11-beta.0

4 years ago

0.0.10

4 years ago

0.0.11-beta.1

4 years ago

0.0.9-beta.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago