Let's look at adding fastboot to our School Directory app that we deployed
yesterday. Maybe the easiest way to get this running locally is to run our Rails
api app from yesterday locally on port 3001 (we need port 3000 for our fastboot
server), making sure our host in
localhost:3001, and making sure our Rails API has
localhost:3000 as it's permissible origins in
Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do # origins 'dailydrip-school-directory.herokuapp.com' origins 'localhost:4200', 'localhost:3000' resource '*', headers: :any, methods: [:get, :post, :put, :patch, :delete, :options, :head] end end
Start your rails server, from your Rails root:
rails s -p 3001
To install Ember Fastboot, from the root of your Ember app, type:
ember install ember-cli-fastboot
Then, to start your fastboot server in development just type
--serve-assets. Now, if you open your site at http://localhost:3000, you will
be seeing a server rendered version of your site.
You can use curl to see your server generated Ember app:
curl localhost:3000/contacts/1 both produce the
results we would expect from a server generated site.
Finally, the only thing you have to do to deploy your site is change your host
app/adapters/application.js back to your production Rails API. Then commit
and deploy to heroku:
git add . git commit -m'added fastboot' git push heroku 11.2.start:master
That's it, now you should have Fastboot running in production. To see other strategies for deploying your fastboot application you can see the link about deploying Fastboot below.