{"id":21753705,"url":"https://github.com/includable/serverless-middleware","last_synced_at":"2025-10-08T14:16:14.849Z","repository":{"id":42630587,"uuid":"378144014","full_name":"includable/serverless-middleware","owner":"includable","description":"Default serverless middleware for some of our projects.","archived":false,"fork":false,"pushed_at":"2025-02-14T23:09:22.000Z","size":1010,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T05:46:58.474Z","etag":null,"topics":["aws-lambda","nodejs","serverless"],"latest_commit_sha":null,"homepage":"https://flexible.agency","language":"JavaScript","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/includable.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"tschoffelen"}},"created_at":"2021-06-18T12:30:39.000Z","updated_at":"2025-09-20T16:36:48.000Z","dependencies_parsed_at":"2023-07-17T09:15:47.459Z","dependency_job_id":"1f4599e6-c03b-408c-a0cf-e068719be0a3","html_url":"https://github.com/includable/serverless-middleware","commit_stats":{"total_commits":72,"total_committers":2,"mean_commits":36.0,"dds":0.1527777777777778,"last_synced_commit":"930f4b19bf623e6df0ccc5f22f781229cd700fd6"},"previous_names":["flexible-agency/serverless-middleware"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/includable/serverless-middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/includable%2Fserverless-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/includable%2Fserverless-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/includable%2Fserverless-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/includable%2Fserverless-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/includable","download_url":"https://codeload.github.com/includable/serverless-middleware/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/includable%2Fserverless-middleware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278956386,"owners_count":26075238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"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":["aws-lambda","nodejs","serverless"],"created_at":"2024-11-26T09:10:57.217Z","updated_at":"2025-10-08T14:16:14.803Z","avatar_url":"https://github.com/includable.png","language":"JavaScript","readme":"# Serverless Middleware\n\nA helper for writing APIs using AWS Lambda functions.\n\n### Features\n\n- Dependency injection for easy unit testing.\n- Pretty JSON error output, with status codes automatically determined based on error message.\n- Easy access to query strings and JSON body properties.\n- Serverless warmup plugin support.\n- OpenTelemetry support and additional span attributes, for use with [opentelemetry-lambda](https://github.com/open-telemetry/opentelemetry-lambda).\n\n---\n\n## Installation\n\n```shell\nyarn add @includable/serverless-middleware\n```\n\n## Example usage\n\n```js\nimport { middleware, auth } from \"@includable/serverless-middleware\";\n\nconst dependencies = {\n  // dependencies for the dependency injector\n};\n\nexport const app = async (\n  { query, path, body },\n  { currentUser /* dependences */ },\n) =\u003e {\n  // if `auth` is included in the second param of `middleware`, currentUser\n  // will be an object in the form of `{ id, groups, email, ... }`\n\n  // your business logic goes here\n\n  return {\n    success: true,\n    text: \"Hello, world!\",\n  };\n};\n\nexport const handler = middleware(app, [auth]).register(dependencies);\n```\n\n## Options\n\n### Warmup support\n\nOut of the box this middleware setup supports the [serverless-plugin-warmup](https://github.com/FidelLimited/serverless-plugin-warmup)\nserverless plugin.\n\nSimply install the serverless plugin, no other changes to your code necessary.\nThe middleware will automatically prevent code execution on warmup requests.\n\n### OpenTelemetry span enrichment\n\nIf an active OpenTelemetry span is detected, event and response properties will automatically be added.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cb\u003e\n\t\t\u003ca href=\"https://includable.com/consultancy/?utm_source=serverless-middleware\"\u003eGet professional support for this package →\u003c/a\u003e\n\t\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003csub\u003e\n\t\tCustom consulting sessions availabe for implementation support and feature development.\n\t\u003c/sub\u003e\n\u003c/div\u003e\n","funding_links":["https://github.com/sponsors/tschoffelen"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincludable%2Fserverless-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincludable%2Fserverless-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincludable%2Fserverless-middleware/lists"}