Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// LOL this is not production code, but "inspired" by production code
const FastBoot = require('fastboot');
const FastBootAppServer = require('fastboot-app-server');
const server = new FastBootAppServer({
gzip: true, // enable gzip compression
beforeMiddleware(app) {
app.use(async (request, response, next) => {
if (request.path === '/render') {
const app = new FastBoot({ distPath: 'dist' });
const result = await app.visit('/render', { request, response }); // <== our Ember.js rendering route
const { body } = result.domContents();
response.end(body);
} else {
next();
}
});
},
});
process.on('uncaughtException', function(error) {
logger.error(`exiting, uncaught exception: ${error}`);
// fail early, fail hard
// here be an unknown error, gracefully shut down the process, fastboot will restart it
process.exit(1);
});
server.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.