I am writing my first Opa application. I am trying to set up a match for url handling. Code is as follows:
function start(url)
{
match (url)
{
case {path:[] ...}: Resource.page("Home", home())
case {...}: Resource.page("nofindy", nofindy())
}
}
Server.start(Server.http, { dispatch: start })
It works like a charm, but now I want to be able to do synonymous mappings. For example, I would like to be able to not only have / go to the home page, but also /home.
Is there a concise way to do this, perhaps with an OR operator, or do I need to set up separate cases that both trigger the same resource?
tl;dr: is there a better way to write the following snippet:
case {path:[] ...}: Resource.page("Home", home())
case {path:["home"] ...}: Resource.page("Home", home())