Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookies and session #7

Open
wallymathieu opened this issue Jun 2, 2019 · 0 comments
Open

Cookies and session #7

wallymathieu opened this issue Jun 2, 2019 · 0 comments
Labels
discussion enhancement New feature or request

Comments

@wallymathieu
Copy link
Member

Description

Suave implements cookie session. See SuaveIO Example/Program.fs

    path "/session"
      >=> statefulForSession // Session.State.CookieStateStore
      >=> context (fun x ->
        match HttpContext.state x with
        | None ->
          // restarted server without keeping the key; set key manually?
          let msg = "Server Key, Cookie Serialiser reset, or Cookie Data Corrupt, "
                    + "if you refresh the browser page, you'll have gotten a new cookie."
          OK msg

        | Some store ->
          match store.get "counter" with
          | Some y ->
            store.set "counter" (y + 1)
            >=> OK (sprintf "Hello %d time(s)" (y + 1) )
          | None ->
            store.set "counter" 1
            >=> OK "First time")

While Giraffe implements functionality more in line with asp.net core: Giraffe/Auth.fs

@wallymathieu wallymathieu added enhancement New feature or request discussion labels Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant