JSPM

hops-express

10.3.0-rc.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q71797F
  • License MIT

Express server to enable server-side rendering of hops applications

Package Exports

  • hops-express

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hops-express) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hops Express

npm

hops-express creates a minimal Express server which takes care of serving static assets and registering a middleware built using hops-build.

hops-express doesn't generate the middleware itself but assumes that it is named server.js inside the hopsConfig.cacheDir (see hops-config for more details).

API

createApp()

createApp() creates an Express app, applies all the middleware configuration and returns the app object ready to call app.listen(host, port) on it.

runServer(callback)

runServer() is a small wrapper around createApp() and executes app.listen() with the values provided through hops-config.

Target Audience

This package is intended for users that want to use server-side rendering with hops - be it on your own machine, Heroku, Lambda or anywhere else.

The server contained in this app is meant for production usage. During development, use hops-build directly.

Example

serve.js

var hopsExpress = require('hops-express');

hopsExpress.runServer(function(error) {
  if (error) {
    console.error(error);
  } else {
    console.log('server started successfully');
  }
});