I have this urlMappings in grails
"/"(controller: 'home', action: 'index')
"/$id"(controller: 'home', action: 'index')
is there a better way to write this, without duplicate code? If I use only one, the other urlMapping won't work.
Thanks in advance
If you want to combine the two URL mappings you can do so by making the id
parameter optional like this:
"/$id?"(controller: 'home', action: 'index')