{"id":36830819,"url":"https://github.com/zeluisping/eckspress","last_synced_at":"2026-01-12T14:12:45.328Z","repository":{"id":47987644,"uuid":"198898362","full_name":"zeluisping/eckspress","owner":"zeluisping","description":"Just a way to use middlewares with contexts with nice typescript type inference.","archived":false,"fork":false,"pushed_at":"2022-12-10T23:50:50.000Z","size":57,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T05:22:28.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eckspress","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeluisping.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T20:39:24.000Z","updated_at":"2024-05-29T11:45:49.000Z","dependencies_parsed_at":"2023-01-26T12:46:11.359Z","dependency_job_id":null,"html_url":"https://github.com/zeluisping/eckspress","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/zeluisping/eckspress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeluisping%2Feckspress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeluisping%2Feckspress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeluisping%2Feckspress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeluisping%2Feckspress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeluisping","download_url":"https://codeload.github.com/zeluisping/eckspress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeluisping%2Feckspress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2026-01-12T14:12:45.259Z","updated_at":"2026-01-12T14:12:45.318Z","avatar_url":"https://github.com/zeluisping.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eckspress\n\nJust a way to use middlewares with contexts with nice typescript type inference.\n\n# Example\n\nAn example usage, for what is currently implemented, could be something like this:\n\n```typescript\nimport { Request, Response, Router } from 'express';\nimport { BadRequest, Endpoint, Success } from 'eckspress';\n\nconst router = Router();\nexport default router;\n\n// each type of response has a static method for adding logging for example\n// note that the status code is already set before this is called\nBadRequest.Handler = async (req, res, body, extra) =\u003e {\n    console.log('BAD REQUEST', JSON.stringify(extra));\n};\n\n// a really simple middleware\nasync function paramID(req: Request, res: Response) {\n    if (isNaN(+req.params.id)) {\n        // automatically handles response\n        return new BadRequest('invalid id, must be number', {\n            params: req.params.id,\n        });\n    }\n    return { id: +req.params.id };\n}\n\nrouter.get(\n    '/:id',\n    Endpoint([paramID], async (context, req, res) =\u003e {\n        return new Success(`Requested id ${context.id}`);\n\n        // you can also manually handle the response by returning the express.Response instance:\n        // return res.status(200).send(``);\n    }),\n);\n```\n\nYour `context` parameter in the handler would automatically tell you what the middlewares provide you with.\n\nWhen a middleware returns a `BadResult` (like `BadRequest`), no further middlewares not handler are called, and an apropriate response will automatically be sent back.\n\nWith a middleware being able to return an error and stop the chain flow, easily you can implement an authorization middleware.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeluisping%2Feckspress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeluisping%2Feckspress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeluisping%2Feckspress/lists"}