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

How to parse id when URL ends in .json? #190

Closed
andrewhavens opened this issue Oct 26, 2016 · 2 comments
Closed

How to parse id when URL ends in .json? #190

andrewhavens opened this issue Oct 26, 2016 · 2 comments

Comments

@andrewhavens
Copy link

I am defining a route for a URL that looks like this: http://example.com/some_models/123.json

this.get('some_models/:id.json', function(request) {
  // ...
});

The problem is that pretender is getting confused by the .json at the end. How can I define this route to be able to parse the :id?

@trek
Copy link
Member

trek commented Jan 2, 2017

This is likely a question for the people at https://github.com/tildeio/route-recognizer: See tildeio/route-recognizer#126

@trek trek closed this as completed Jan 2, 2017
@nathanhammond
Copy link
Contributor

nathanhammond commented Jan 5, 2017

Solution:

this.get('some_models/:id', function(request) {
  // Inspect the ID, match on `.json` for example, respond appropriately.
});

Feedback: tildeio/route-recognizer#125 (comment)

/cc @amiel

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

3 participants