redstone-dart / redstone

A metadata driven microframework for Dart.
http://redstone-dart.github.io/redstone
MIT License
342 stars 42 forks source link

Question: Routes with optional extension #76

Closed austincummings closed 9 years ago

austincummings commented 9 years ago

Hello again,

First off I would like to say I've been using your library for awhile and it is absolutely great to work with. Now I was wondering if there is a way to have a route that has an optional extension/suffix. I see that the @DefaultRoute annotation has a pathSuffix, but I would like to have one route that catches /queries/1.json and /queries/1. Then have that route run the same logic despite the additional extension. This is for a RESTful API.

Thanks!

luizmineo commented 9 years ago

Try this:

@app.Route('/queries/1.json')
@app.Route('/queries/1')
myService() {
  ...
}

Maybe not a proper solution, but it works.

austincummings commented 9 years ago

That works for me. Thanks.