Closed falsandtru closed 5 years ago
E.g. https://haskell-servant.readthedocs.io/en/stable/cookbook/db-sqlite-simple/DBConnection.html recipe describes stateful application, the state is stored in SQLite, but in the same way you can store parts of it in IORef
s or TVar
s.
That example doesn't support membership feature like CMS. I'm reading https://docs.servant.dev/en/stable/cookbook/jwt-and-basic-auth/JWTAndBasicAuth.html and https://docs.servant.dev/en/stable/cookbook/hoist-server-with-context/HoistServerWithContext.html but second page's examples lack authentication checks written in the first page. So I think I have to integrate the techniques written in the two pages to implement membership feature. I want that integrated example.
I agree such a cookbook recipe like you describe would be useful.
Is there any site implemented by Servant provided for many users like Wordpress or EC site? I'm not sure that Servant can make it and supports it officially.
I'm not sure i understand the question
Are you asking if servant is production ready? Yes it is, it is used by many Haskell companies and hosts quite a few big websites and APIs.
Can you list the achievements like the other products? In that list I want to find a web site which supports membership feature like Wordpress.
Https://cachix.org is a good example as they're a non-trivial application with login support. Their API spec is here https://github.com/cachix/cachix/tree/master/cachix-api
We don't have a list of projects that use servant at the moment I think. I agree that such a list would be useful. If you're willing to make a PR to the website to create such a list of and projects that you encountered in your research that would be awesome.
An ability to provide both a personalized page and an not personalized page with the same URL is a required feature of WAF. Looks like that site lacks it. Is there another example which resolved it and uses cookie (generalized, not Basic or JWT) authentications?
That Servant code doesn't provide the front page as follows.
type CachixServantAPI = "api" :> "v1" :> ToServantApi CachixAPI
https://github.com/cachix/cachix/blob/master/cachix-api/src/Cachix/Api.hs#L162
Is there any site implemented by Servant provided for many users like Wordpress or EC site? I'm not sure that Servant can make it and supports it officially.
There are. I've written sites and apps that implement all sorts of things like this, all private projects though. We don't have a list like you're asking for at this point indeed, the closest would be to do a github code search like https://github.com/search?o=desc&q=%22import+Servant%22+language%3AHaskell&s=indexed&type=Code -- you can then try and see if there's something that fits in there, or to refine the search to find it.
More generally, Servant just provides a way to describe endpoints. What the handlers can do is identical with other frameworks, the question usually is more about how to """best""" achieve X or Y, how to design things.
I see, thanks.
Probably beginners have to understand
Context
feature and a lot of undocumented details to create a stateful web application but this analysis is a hard work. Could you provide an implementation example?