Q:

Single Page Web Apps. Many requests made at application startup OK?

I have been working on a Single Page Web App (SPA) for some time. Frontend uses BackboneJS/Marionette, Backend is Java Spring :(. But what I find possibly slow is at application start, many requests are made to different API end points to populate data for various parts of the application. I think this is slow? Though they are AJAX requests and therefore done asynchronously? Whats the best practice? At first I was thinking I somehow combine everything into 1 huge request, but not sure if thats a very good idea. Also code examples are nice. 

A:

Since you know what should be there on page load, all this data should really be served along with your default html and your objects initialized with it. I use AMD so I would do it like,
<script data-main="app" src="/lib/require.js"></script>
<script>
define('load', function(){return {
    mymodel : <c:out value="${mymodel}" default="{}" />,
        ...
};});
</script>

app.js:
require([ 'MyModel', 'load'], function(MyModel, load) {
  var myModel = new MyModel(load.mymodel);
   ...
})

