Sgoettschkes
Sgoettschkes

Reputation: 13189

Server-Side routing for single page app

I am trying to get my Dart Polymer 1.0 single page app working with pushState. I have set up nginx to route all requests to the dev server which runs when executing pub serve. Nginx also takes care of always requesting index.html instead of the real url.

The problem I am facing is that as soon as I load a url with at least one folder, the js cannot be loaded anymore.

Example

Requesting project.local loads the index.html file and works fine. The same is true for project.local/test. As soon as I try going to project.local/test/something, it stops working because the file index.bootstrap.initialize.dart is requested from project.local/test/index.bootstrap.initialize.dart and not from project.local/index.bootstrap.initialize.dart.

Source code

The whole project can be found at https://github.com/agileaddicts/blitzlicht. The index.html is where the magic happens.

How do I tell the transformer to put absolute urls into the html instead of relative ones?

Upvotes: 1

Views: 297

Answers (1)

Hadrien Lejard
Hadrien Lejard

Reputation: 5904

you should by able to upgrade to the last version of polymer by changing the version of reflectable. reflectable: >=0.5.0

and perhaps add this in you pubspec - $dart2js: $include: '**/*.bootstrap.initialize.dart'

Upvotes: 3

Related Questions