Fastboot and express.js


#1

hey all. i have an express.js server that serves up static html on most of its routes, and an ember app on just one route (let’s say that’s /app). what i want to do is have my ember app render as a fastboot app when hitting /app. i’ve been reading the fastboot-app-server documentation, and i feel like i’m missing something.

how do integrate a fastboot-app-server into an existing express app?


#2

There’s fastboot-express-middleware if fastboot-app-server is not the right one for you.


#3

thanks for the response! i’ve seen this, but have been hesitant to use it since the fastboot docs suggest using fastboot-app-server. i wonder if anyone has experience using fastboot-express-middleware in production.


#4

Yeah I don’t think the fastboot website is updated. You could see here that they want you to use what’s right for your case.


#5

I think using the fastboot middleware in production is a-ok :+1: .

Fastboot-app-server gives you some nice out of the box functionality like chunked responses, compression, and clustering. However, most of these features are provided by existing express middlewares, so it’s not unrealistic to create your own express app server using the fastboot middleware.

If you want to see how fastboot-app-server wires up everything in express, including the fastboot middleware, take a look at this file: https://github.com/ember-fastboot/fastboot-app-server/blob/master/src/express-http-server.js#L54


#6

I absolutely agree with @ryanto here, the parts of the stack are split up specifically to allow you to compose them how it works best in your production environment…


#7

thanks so much for this response. i figured that was the case, but as mentioned above, i felt like the main fastboot site was implying that the fastboot-app-server was the only and best way to deploy fastboot.


#8

this is an awesome link, thanks. it really helps seeing these implementations. what you’re saying about out-of-the-box functionality makes perfect sense now, but was lost on me while reading the fastboot docs (which are, admittedly, a bit dated).