Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing AngularJS Versus PlayFramework Paths #19

Open
moidx opened this issue Oct 14, 2015 · 0 comments
Open

Routing AngularJS Versus PlayFramework Paths #19

moidx opened this issue Oct 14, 2015 · 0 comments

Comments

@moidx
Copy link

moidx commented Oct 14, 2015

AngularJS routes are not properly handled by the backend. For example:

 /users/create

Results in an unresolved request in the backend. It would be preferred if in this case the back end forwards the URI to AngularJS, so that the template can be resolved in the front end. For example, consider the proposed route:

GET     /*any                       @controllers.Application.main(any)

And the following controller function:

  def main(any: String) = Action {
      logger.info("Serving index page via AngularJS...")
      val javascripts = { ... }
      Ok(views.html.index(javascripts))
   }

Using this approach, PlayFramework will forward the URI to AngularJS. The drawback in this case is that PlayFramework routes must be different from AngularJS ones to avoid conflicts. This can be solved by adding a prefix to all the asynchronous routes (e.g. /api/users instead of /users). I am not 100% sure this is the best way to solve the problem, so it would be nice to hear more ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant