{"id":19680082,"url":"https://github.com/drewolson/purescript-httpure-contrib-biscotti","last_synced_at":"2026-03-19T11:03:01.044Z","repository":{"id":35113480,"uuid":"205703626","full_name":"drewolson/purescript-httpure-contrib-biscotti","owner":"drewolson","description":"Helpers for using Biscotti Cookies and Sessions with HTTPure applications","archived":false,"fork":false,"pushed_at":"2023-03-05T22:44:34.000Z","size":171,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-18T16:44:06.246Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drewolson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-01T16:33:28.000Z","updated_at":"2023-07-25T14:28:43.000Z","dependencies_parsed_at":"2025-02-27T06:32:55.225Z","dependency_job_id":"b65ee313-aebe-46c4-9fef-539cabe88485","html_url":"https://github.com/drewolson/purescript-httpure-contrib-biscotti","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/drewolson/purescript-httpure-contrib-biscotti","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-httpure-contrib-biscotti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-httpure-contrib-biscotti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-httpure-contrib-biscotti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-httpure-contrib-biscotti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drewolson","download_url":"https://codeload.github.com/drewolson/purescript-httpure-contrib-biscotti/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-httpure-contrib-biscotti/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28987278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T18:17:03.387Z","status":"ssl_error","status_checked_at":"2026-02-01T18:16:57.287Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T18:03:55.329Z","updated_at":"2026-02-01T19:32:34.932Z","avatar_url":"https://github.com/drewolson.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# purescript-httpure-contrib-biscotti\n\n[![Build\nStatus](https://github.com/drewolson/purescript-httpure-contrib-biscotti/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/drewolson/purescript-httpure-contrib-biscotti/actions/workflows/test.yml)\n\nDocumentation is on\n[Pursuit](https://pursuit.purescript.org/packages/purescript-httpure-contrib-biscotti).\n\nThis library provides a middleware that uses\n[Biscotti.Cookie](https://github.com/drewolson/purescript-biscotti-cookie) and\n[Biscotti.Session](https://github.com/drewolson/purescript-biscotti-session) to\nadd session handling to an\n[HTTPure](https://github.com/cprussin/purescript-httpure) application. The\n`Biscotti.middleware` function requires a session store and then behaves similar\nto other `HTTPure` middleware.\n\nSuppose the type of your session is:\n\n```purescript\ntype Session = { currentUser :: String }\n```\n\nNote that _any_ type which implements `EncodeJson` and `DecodeJson` from\n[Argonaut](https://github.com/purescript-contrib/purescript-argonaut) can be\nused as your session type.\n\nThe primary difference from other middleware is that `Biscotti.middleware`\nexpects the next middleware in the stack to receive a `Maybe Session` along with the\n`HTTPure.Request`.  It expects the return type to be an `MonadAff m =\u003e m (Tuple\nHTTPure.Response (Maybe Session))` rather than just a `m HTTPure.Response`.\n\nIf you return `Nothing` for your `Session`, your session will be destroyed. If\nyou return a `Just Session`, your session will be created if it doesn't\ncurrently exist, otherwise it will be updated.\n\nHere's a small example application:\n\n```purescript\nimport Biscotti.Session as Session\nimport HTTPure.Contrib.Biscotti as Biscotti\n\ntype Session = { currentUser :: String }\n\nrouter :: Maybe Session -\u003e HTTPure.Request -\u003e Aff (Tuple HTTPure.Response (Maybe Session))\nrouter session req = do\n  case req of\n    { path: [\"login\"] } -\u003e do\n      response \u003c- HTTPure.ok \"login\"\n      pure $ Tuple response (Just { currentUser: \"Drew\" })\n\n    { path: [\"logout\"] } -\u003e do\n      response \u003c- HTTPure.ok \"logout\"\n      pure $ Tuple response Nothing\n\n    _ -\u003e do\n      response \u003c- HTTPure.ok \"hello\"\n      pure $ Tuple response session\n\nmain :: Effect Unit\nmain = launchAff_ do\n  let cookieName = \"_test\"\n  store \u003c- liftEffect $ Session.memoryStore cookieName\n  let middleware = Biscotti.middleware cookieName store\n\n  liftEffect $ HTTPure.server (middleware router) do\n    log \"Server running\"\n```\n\nIn a larger application, you may prefer to have another layer of middleware that\nplaces the `Session` in a `StateT` to make it easier to access and modify within\nyour router.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewolson%2Fpurescript-httpure-contrib-biscotti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrewolson%2Fpurescript-httpure-contrib-biscotti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewolson%2Fpurescript-httpure-contrib-biscotti/lists"}