FastBoot is a library for rendering Ember.js applications in Node.js.
For more information about FastBoot, see www.ember-fastboot.com, the Ember CLI addon that's a prerequisite for developing FastBoot apps.
To serve server-rendered versions of your Ember app over HTTP, see the FastBoot App Server.
FastBoot requires Node.js v4 or later.
const FastBoot = ;let app =distPath: 'path/to/dist'// optional boolean flag when set to true does not reject the promise if there are rendering errors (defaults to false)resilient: <boolean>sandbox: 'path/to/sandbox/class' // optional sandbox class (defaults to vm-sandbox)sandboxGlobals: ... // optional map of key value pairs to expose in the sandbox;app;
In order to get a
dist directory, you will first need to build your
Ember application, which packages it up for using in both the browser
and in Node.js.
app.visit takes a second parameter as
options above which a map and allows to define additional optional per request
resilient: whether to reject the returned promise if there is an error during rendering. If not defined, defaults to the app's resilient setting.
html: the HTML document to insert the rendered app into. Uses the built app's index.html by default.
metadata: per request meta data that is exposed in the app via the fastboot service.
shouldRender: boolean to indicate whether the app should do rendering or not. If set to false, it puts the app in routing-only. Defaults to true.
disableShoebox: boolean to indicate whether we should send the API data in the shoebox. If set to false, it will not send the API data used for rendering the app on server side in the index.html. Defaults to false.
destroyAppInstanceInMs: whether to destroy the instance in the given number of ms. This is a failure mechanism to not wedge the Node process
To get your Ember.js application ready to both run in your user's browsers and run inside the FastBoot environment, run the Ember CLI build command:
$ ember build --environment production
(You will need to have already set up the Ember CLI FastBoot addon. For more information, see the FastBoot quickstart.)
Once this is done, you will have a
dist directory that contains the
multi-environment build of your app. Upload this file to your FastBoot
You can start a simple HTTP server that responds to incoming requests by rendering your Ember.js application using the FastBoot App Server
fastboot with the
DEBUG environment variable set to
for detailed logging.
You can pass application state from the FastBoot rendered application to the browser rendered application using a feature called the "Shoebox". This allows you to leverage server API calls made by the FastBoot rendered application on the browser rendered application. Thus preventing you from duplicating work that the FastBoot application is performing. This should result in a performance benefit for your browser application, as it does not need to issue server API calls whose results are available from the Shoebox.
The contents of the Shoebox are written to the HTML as strings within
<script> tags by the server rendered application, which are then consumed
by the browser rendered application.
This looks like: