Skip to content

Latest commit

 

History

History
74 lines (44 loc) · 2.87 KB

README.md

File metadata and controls

74 lines (44 loc) · 2.87 KB
routify

Small Express server with SSR

Usage example

$ npx spassr --assets-dir dist --entrypoint dist/index.html --script dist/build/bundle.js --ssr

Configuration

Spassr can be configured through CLI, package.json, spassr.config.js and .env.

Environment variables are converted from snake_case to camelCase, so SPASSR_assets_dir = dist becomes {... assetsDir: 'dist'}

For configuration options, refer to the API below.


API

Table of Contents

spassr

Parameters
  • options Partial<config.Config> *

Config

Type: object

Properties
  • assetsDir (string | Array<string>) folders with static content to be served.
  • entrypoint string HTML template, eg. assets/index.html.
  • script string path to app, eg. build/bundle.js.
  • port (string | number) port to serve on.
  • ssr boolean enable SSR for routes not resolved in assetsDir.
  • silent boolean quiet console.log.
  • middleware Function function to customize SPA server (Not available in CLI).
  • ssrOptions Partial<tossr.Config> options to pass to ssr.

Eval

Called before/after the app script is evaluated

Type: Function

Parameters

config

Type: Config


Business vector created by teravector - www.freepik.com