Step 2 Fetch data in frontend - Thewessen/tic-tac-toe_ruby_backend GitHub Wiki

Learning Ember.js

Let's not make the same mistake, and start a new branch : )

WOW sooo awesome. Ember.js uses all the great ES6 syntax and features: method definition in objects, spread operators, template literals!! First time I see any usecase for template literals. This is so cool.

Not done yet: Integrated watch and chrome page refresh after saving a file! And even automated running test in the browser after saving. Do React or Angular have these features?? I'm sure you could set it up. It's awesome!

Oh, and did I mention using Promises? :D

Problems: fetching data from the rest api

Communication between the front end and the backend didn't go smooth. It sat me back for quite some hours!

One of the problems was with cross origin resource sharing. I had to figure out a way to make it avialable on the server. In the end I started using a gem called rack-cors. This helped me alot! For development purposes, I have configured it too accept request from all origins.

Ember.js models like a JSON:API for. I'm oke with that, but couldn't figure out a way to build it. I couldn't make up anything from the error-messages. And also couldn't figure out a way to log the incoming data for further inspection (before JSONApiSerealize kicks in). After a good night sleep, I looked at some JSON:API examples again, and reordend my data in the backend. After just 10 minutes I solved it, pffff...

I also made a terrible mistake on github when I was getting tiered. Deleting all my recent data and pushing to the server xD Lucky git has some nice way's of going back in history. I choose the savest one, and created a new branch with my old data. All I needed to do was migrating the database and setting up the CORS policy again.

In the prosess, I stored the boardstate JSON as a regular string in the database, komma seperated. In the end, this is much easier to work with, so I'll keep it this way.

Step 2 done.

⚠️ **GitHub.com Fallback** ⚠️