I am trying to add Obelisk-OAuth to my project: https://github.com/obsidiansystems/obelisk-oauth
At this instruction I am stuck:
Your backend route encoder should handle this case:
...
pathComponentEncoder $ \case
BackendRoute_OAuth -> PathSegment "oauth" oauthRouteEncoder
...
The only thing that I see similar in my Obelisk project is:
backend :: Backend BackendRoute FrontendRoute
backend = Backend
{ _backend_run = \serve -> serve $ const $ return ()
, _backend_routeEncoder = fullRouteEncoder
}
From Backend.hs.
But this does not seem like the correct location.
Has anyone encountered this before? Where do I insert that pathComponentEncoder $ \case expression?
fullRouteEncoderis defined incommon/src/Common/Route.hs.All routes are defined in the "common" package (which is shared between the frontend and the backend). This is where you would inject the oauth routes. The file you quoted above is Backend.hs, which uses
fullRouteEncoderdefined in common.