{"id":20125726,"url":"https://github.com/yornaath/fp-ts-http","last_synced_at":"2026-05-19T07:05:13.390Z","repository":{"id":34985680,"uuid":"194330366","full_name":"yornaath/fp-ts-http","owner":"yornaath","description":"Opinionated, strongly typed http middleware library using fp-ts fp-ts-routing and io-ts for decoding of io","archived":false,"fork":false,"pushed_at":"2022-12-06T18:26:05.000Z","size":801,"stargazers_count":3,"open_issues_count":13,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-30T19:47:25.408Z","etag":null,"topics":["fp-ts","functional","functional-programming","http","io-ts","koa","koa2","rest","routing","types"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yornaath.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-28T20:27:12.000Z","updated_at":"2024-03-03T10:03:44.000Z","dependencies_parsed_at":"2023-01-15T11:30:48.553Z","dependency_job_id":null,"html_url":"https://github.com/yornaath/fp-ts-http","commit_stats":null,"previous_names":["gorillatron/fp-ts-http"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yornaath/fp-ts-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yornaath%2Ffp-ts-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yornaath%2Ffp-ts-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yornaath%2Ffp-ts-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yornaath%2Ffp-ts-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yornaath","download_url":"https://codeload.github.com/yornaath/fp-ts-http/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yornaath%2Ffp-ts-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33205520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"online","status_checked_at":"2026-05-19T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["fp-ts","functional","functional-programming","http","io-ts","koa","koa2","rest","routing","types"],"created_at":"2024-11-13T20:09:37.883Z","updated_at":"2026-05-19T07:05:13.367Z","avatar_url":"https://github.com/yornaath.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# fp-ts-http\n\n### Install\n\nIncludes `fp-ts` `fp-ts-routing` and `io-ts`\n\n```bash\nnpm i fp-ts-http\n```\n\n## Example\n```typescript\nimport { end, lit, int } from 'fp-ts-routing'\nimport * as io from \"io-ts\"\nimport { get, post, driver } from \"./\"\nimport { TMiddlewareStack } from './Middleware';\nimport { none } from 'fp-ts/lib/Option';\n\nconst stack: TMiddlewareStack = []\n\nconst userById = lit('users').then(int(\"userid\"))\n\nconst stack2 = [\n  ...stack, \n  ...get\u003c{userid: number}, {}, string\u003e(userById.then(end), io.strict({}), \n  async(req) =\u003e {\n    return {\n      status: 200,\n      headers: none,\n      body: JSON.stringify(req.path)\n    }\n  })]\n\nconst userMessages = userById.then(lit(\"messages\"))\nconst userMessageDto = io.type({ message: io.string })\n\nconst stack3 = [\n  ...stack2, \n  ...post\u003c{userid: number}, {}, {message: string}, string\u003e(userMessages.then(end), io.strict({}), userMessageDto, async(req) =\u003e {\n    return {\n      status: 200,\n      headers: none,\n      body: JSON.stringify(req.path)\n    }\n  })]\n\n\ndriver(stack3, 3000).run()\n  .then(() =\u003e console.log(\"server running\"))\n```\n\n## Advanced query parsing example\n```typescript\n\nimport { end, lit, query, str } from 'fp-ts-routing'\nimport * as io from \"io-ts\"\nimport { get, post, driver } from \".\"\nimport { TMiddlewareStack } from './Middleware';\nimport { none } from 'fp-ts/lib/Option';\nimport { NumberFromString, BooleanFromString, ArrayFromString } from './Query';\n\n\nconst stack: TMiddlewareStack = []\n\ntype TUsersPath = {\n  type: string;\n}\n\nconst usersQuery = io.strict({\n  filter: io.union([ io.undefined, io.string ]),\n  validStatusCodes: io.union([ io.undefined, ArrayFromString\u003cnumber\u003e(NumberFromString) ]),\n  sortBy: io.union([ io.undefined, io.string]),\n  sortDirection: io.union([ io.undefined, BooleanFromString])\n})\n\ntype TUsersQuery = io.TypeOf\u003ctypeof usersQuery\u003e\n\ntype TUsersResponseBody = string\n\nconst users = lit(\"users\").then(str(\"type\"))\n\nconst stack2 = [\n  ...stack, \n  ...get\u003cTUsersPath, TUsersQuery, TUsersResponseBody\u003e(users.then(end), usersQuery, \n  async(req) =\u003e {\n    return {\n      status: 200,\n      headers: none,\n      body: await UserRepository.find({ \n        type: req.path.type, \n        sortBy: req.path.sortBy,\n        sortDirection: req.path.sortDirection\n      })\n    }\n  })]\n\ntype TUserMessageDto = {\n  message: string\n}\n\nconst userMessages = users.then(lit(\"messages\"))\nconst userMessageDto = io.type({ message: io.string })\n\ntype TUserMessagesResponseBody = string\n\nconst stack3 = [\n  ...stack2, \n  ...post\u003cTUsersPath, TUsersQuery, TUserMessageDto, TUserMessagesResponseBody\u003e(userMessages.then(end), usersQuery, userMessageDto, \n  async(req) =\u003e {\n\n    const users = await UserRepository.find({ \n      type: req.path.type, \n      sortBy: req.path.sortBy,\n      sortDirection: req.path.sortDirection\n    })\n\n    await Promise.all(users.map(async user =\u003e sendMessageToUser(user, req.body)))\n\n    return {\n      status: 200,\n      headers: none,\n      body: JSON.stringify(req.path)\n    }\n  })]\n\n\ndriver(stack3, 3000).run()\n  .then(() =\u003e console.log(\"server running\"))\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyornaath%2Ffp-ts-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyornaath%2Ffp-ts-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyornaath%2Ffp-ts-http/lists"}