In-depth guide: testing connection

In this section: https://donejs.com/place-my-order.html#section=section_Testtheconnection

One can test the connection in the console using the following:

System.import("place-my-order/models/restaurant").then(function(module){
  var Restaurant = module["default"];
  return Restaurant.getList({});
}).then(function(restaurants){
  console.log( restaurants.attr() );
})

However I get the following error:

VM350:1 Uncaught ReferenceError: System is not defined(…)

I have tried in the app (http://localhost:8080/) and well as the api (http://localhost:8080/api).

What am I missing?

OK, turns out it is the order of instructions.

The testing bit works after one completes the ‘Add data to the page’ bit. However, that comes after the test so it should possibly just be moved.