I'm building a site with Snap.
In my routes, how do I match on the site's root directory?
i.e.
routes = [(ByteString, Handler App App ())]
routes = [("/", redirect "www.google.com")]
The above code doesn't redirect when called at(localhost:8000/).
You need to add "http://" to the URI. This works in my machine:
routes = [("/", redirect "http://www.google.com")]
You can also use ifTop
:
site :: Snap ()
site = ifTop (redirect "http://www.google.com) <|>
route routes
Where routes
contains the remaining routes of your site.