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
hops-express creates a minimal Express server which takes care of serving static assets and registering the (through hops-build generated) middleware.
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.
startServer(callback)
startServer() 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 lambda, a local machine, heroku or anywhere else.
The node server contained in this app should be ready for production usage.
Example
serve.js
var hopsExpress = require('hops-express');
hopsExpress.startServer(function (error) {
if (error) {
console.error(error);
} else {
console.log('server started successfully');
}
});