Re: Happstack, Yesod

35 views
Skip to first unread message

Corentin Dupont

unread,
May 10, 2016, 2:21:53 PM5/10/16
to Julian Arni, haskell-servant, ha...@googlegroups.com, Jeremy Shaw

OK... I also use happstack-authenticate for authentication of my website. Can it be used with servant?
I'm not sure if happstack-authenticate can use the auth token in the HTTP header.

In general, how and where do you retrieve an auth token? Should I retrieve from happstack-authenticate?
I found this:
https://hackage.haskell.org/package/happstack-authenticate-2.3.4/docs/src/Happstack-Authenticate-Core.html#getToken
is this the token I should put in the header when making an API request?

On Tue, May 10, 2016 at 3:48 PM, Julian Arni <jka...@gmail.com> wrote:
Nope... the initial work was done by Jeremy Shaw, but someone would have to take over the task of merging it (which involves refactoring some of the common logic, and which relates to work that Greg Hale did with servant-snap). I don't know if anyone is working on that though.

On Tue, May 10, 2016 at 3:29 PM, Corentin Dupont <corenti...@gmail.com> wrote:
Do you know when it will be released?


On Tue, May 10, 2016 at 3:18 PM, Julian Arni <jka...@gmail.com> wrote:
With Yesod it's fairly easy - you can just use the `Raw` combinator

type MyAPI = ServantAPI :<|> "yesod" :> Raw

myServer :: Server MyAPI
myServer = servantServer :<|> toWaiApp ...

With Happstack, servant-happstack is an option (though then you would not be able to use the above method for Yesod, I believe).

Alternatively, you can just proxy the requests to the other frameworks, either by (a) having a proxy server that dispatches to either servant or the other framework based on route or headers or whatever it is, or (b) having one of the servant routes use a proxy (e.g., http-proxy [0]), and again use Raw. (a) is a pretty common technique generally.

[0] https://hackage.haskell.org/package/http-proxy

On Tue, May 10, 2016 at 2:47 PM, Corentin Dupont <corenti...@gmail.com> wrote:
Hi guys,
can I use servant with Happstack?
My app is currently built with Happstack, so it would be nice to handle the REST API also with it.
It seems there is only an alpha release now, right?
And what about Yesod? Is it supported?
Thanks,
Corentin

--
You received this message because you are subscribed to the Google Groups "haskell-servant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-serva...@googlegroups.com.
To post to this group, send email to haskell...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-servant/CAEyhvmo5wub_YCw48q2ijEXHpPguinLgD-W%3D83O-pyqpnY6yag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.




Reply all
Reply to author
Forward
0 new messages