ufront / ufront-mvc

The core MVC framework that powers ufront
MIT License
17 stars 15 forks source link

route: support file extensions #31

Open francescoagati opened 9 years ago

francescoagati commented 9 years ago

actually the router don't support file extension. ins't possible make contet type negotiation using file extension

jasononeil commented 9 years ago

I agree it could be helpful to have:

@:route("/manual/$page.html")
@:route("/manual/$image.png")

as two separate routes. Currently you'd need to do @:route("/manual/$file") and handle the different extensions in the same method.

If we are going to do this it's also worth asking if we will support general substrings as well:

 @:route("/manual/first-$part-last")
 @:route("/manual/start-$part-end")

This would be slightly more complex to implement, especially if we allow multiple captures:

 @:route("/manual/start-$part1-$part2-end")

Do you think that is needed, or mostly just supporting extensions would be helpful?

francescoagati commented 9 years ago

yes but if have see that @:route("/features/$file") isn't trapped and return a 404. This on php. if i do /features/product return 200 if i do /features/product.json return 404