问题
I have added routes to my app in the following format:
addRoutes
[ ("/", redirect "/docs/home")
, ... more routes
]
But for some reason the root handler is being ignored altogether. What is happening here?
回答1:
It turns out that if you have an index.tpl file then the SnapFramework will ignore any "/" mappings and go straight to that instead. To fix the problem I just ran:
git rm snaplets/heist/templates/index.tpl
And then reloaded my templates and the route on root started working.
(I could not find that anywhere in the docs so I decided to post that here)
Edit: I later discovered (with help) that the problem was that I was adding my routes AFTER I ran heistInit. If i added my routes before heistInit then there was no problem.
来源:https://stackoverflow.com/questions/26597971/snap-framework-root-route-not-being-handed