How to use fastboot - 1 common examples

To help you get started, we’ve selected a few fastboot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github izelnakri / mber / lib / utils / fastboot-express-middleware.js View on Github external
export default function(distPath, opts={}) {
  const OPTIONS = typeof distPath === 'string' ? Object.assign({
    distPath: distPath
  }, opts) : distPath;
  const fastboot = OPTIONS.fastboot || new FastBoot({
    distPath: OPTIONS.distPath,
    resilient: OPTIONS.resilient === false ? false : true
  });

  return function(req, response, next) {
    let result;
    fastboot.visit(req.path, { request: req, response: response }).then((res) => {
      result = res;

      return OPTIONS.chunkedResponse ? result.chunks() : result.html();
    }, (error) => console.log('error is', error)).then((body) => {
      let headers = result.headers;
      let statusMessage = result.error ? 'NOT OK ' : 'OK ';

      for (var pair of headers.entries()) {
        response.set(pair[0], pair[1]);

fastboot

Library for rendering Ember apps in node.js

MIT
Latest version published 6 months ago

Package Health Score

65 / 100
Full package analysis

Popular fastboot functions