Accessing Conn (components) within a resource
Closed this issue · 1 comments
Hyper and Hypertrout seem like a great combination to build a RESTful API, but I am struggling a bit with how to access the authentication component within a resource function.
Ideally, the example in examples/RoutingReaderT.purs would concatenate the username from Hyper.Node.BasicAuth.withAuthentication with the greeting "Hello" from the application monad.
Would anyone be able to take a stab at it?
On a side note, thanks @owickstrom for all the work you've done on this project. Are you a genius?
Hi! I think a combination of getConn and _.components.authentication will give you a Maybe t, where t is the authentication data. You should be able to use those in your resource function. I don't have much time to provide a full example, but if you or someone else can that would be a nice addition to the collection of examples.
Glad you like the project! And no, I'm not. I'm just someone who values server-side web technology and great functional programming languages. 😄