{"id":31780660,"url":"https://github.com/beyond-imagination/express-cargo","last_synced_at":"2025-10-10T08:17:28.264Z","repository":{"id":298912598,"uuid":"1000134381","full_name":"Beyond-Imagination/express-cargo","owner":"Beyond-Imagination","description":"express middleware for class-based request parsing","archived":false,"fork":false,"pushed_at":"2025-10-08T08:13:13.000Z","size":912,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-10-08T10:13:05.233Z","etag":null,"topics":["express-js","express-middleware","request","typescript"],"latest_commit_sha":null,"homepage":"https://beyond-imagination.github.io/express-cargo/","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/Beyond-Imagination.png","metadata":{"files":{"readme":"README.ko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-11T10:10:40.000Z","updated_at":"2025-10-03T04:37:33.000Z","dependencies_parsed_at":"2025-08-03T16:16:26.536Z","dependency_job_id":"12367574-5b44-4d1e-8ddf-20b8729d0de9","html_url":"https://github.com/Beyond-Imagination/express-cargo","commit_stats":null,"previous_names":["laggu/express-cargo","beyond-imagination/express-cargo"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Beyond-Imagination/express-cargo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beyond-Imagination%2Fexpress-cargo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beyond-Imagination%2Fexpress-cargo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beyond-Imagination%2Fexpress-cargo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beyond-Imagination%2Fexpress-cargo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Beyond-Imagination","download_url":"https://codeload.github.com/Beyond-Imagination/express-cargo/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beyond-Imagination%2Fexpress-cargo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003304,"owners_count":26083555,"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-10T02:00:06.843Z","response_time":62,"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":["express-js","express-middleware","request","typescript"],"created_at":"2025-10-10T08:17:26.559Z","updated_at":"2025-10-10T08:17:28.253Z","avatar_url":"https://github.com/Beyond-Imagination.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-cargo\n\n**express-cargo**는 Express.js에서 request 데이터를 더욱 쉽고 타입 안전하게 관리할 수 있도록 도와주는 미들웨어 라이브러리입니다.  \n클래스 기반의 데코레이터와 바인딩 기능을 제공하여, 복잡한 request 파싱과 검증을 간결하게 처리할 수 있습니다.\n\n---\n\n## 설치\n\n```bash\nnpm install express-cargo reflect-metadata\n```\n\n---\n\n## 빠른 시작\n\n```ts\nimport express from 'express'\nimport { body, bindingCargo, getCargo, min, header, params } from 'express-cargo'\n\nconst app = express()\napp.use(express.json())\n\nclass RequestExample {\n    @body()\n    name!: string\n\n    @body()\n    @min(0)\n    age!: number\n\n    @params('id')\n    id!: number\n\n    @header()\n    authorization!: string\n}\n\napp.post('/:id', bindingCargo(RequestExample), (req, res) =\u003e {\n    const data = getCargo\u003cRequestExample\u003e(req)\n    // write your code with bound data\n})\n\napp.listen(3000)\n```\n\n---\n\n## 문서\n\n전체 가이드와 API 레퍼런스:  \n👉 [express-cargo 문서](https://beyond-imagination.github.io/express-cargo/)\n\n---\n\n## 주요 특징\n\n- **클래스 기반 request 파싱**: 데코레이터로 body, query, param 등 request 데이터를 자동으로 바인딩\n- **타입 안전성**: TypeScript와 완벽하게 호환\n- **간편한 미들웨어 적용**: 기존 Express 미들웨어와 쉽게 통합\n\n---\n\n### 요청 바인딩 데코레이터\n\n| 데코레이터        | 설명                      | 예시                          |\n|--------------|-------------------------|-----------------------------|\n| `@body()`    | `req.body` 의 필드를 바인딩    | `@body() name: string`      |\n| `@query()`   | `req.query` 의 필드를 바인딩   | `@query() page: number`     |\n| `@params()`  | `req.params` 의 필드를 바인딩  | `@params() id: string`      |\n| `@uri()`     | `@params()` 의 별칭        | `@uri() id: string`         |\n| `@header()`  | `req.headers` 의 필드를 바인딩 | `@header() token: string`   |\n| `@session()` | `req.session` 의 필드를 바인딩 | `@session() userId: string` |\n\n---\n\n### 검증 데코레이터\n\n| 데코레이터                                | 설명                                | 예시                                                                                         |\n|--------------------------------------|-----------------------------------|--------------------------------------------------------------------------------------------|\n| `@optional()`                        | 값이 없는 경우 밸리데이션을 하지 않음             | `@optional() value?: number`                                                               |\n| `@min(minimum: number)`              | 숫자가 `minimum` 이상이어야 함             | `@min(18) age!: number`                                                                    |\n| `@max(maximum: number)`              | 숫자가 `maximum` 이하이어야 함             | `@max(100) score!: number`                                                                 |\n| `@range(min: number, max: number)`   | 숫자가 `min` 이상 `max` 이하 범위에 포함되어야 함 | `@range(1, 5) rating!: number`                                                             |\n| `@prefix(prefixText: string)`        | 문자열이 `prefixText` 로 시작해야 함        | `@prefix('IMG_') fileName!: string`                                                        |\n| `@suffix(suffixText: string)`        | 문자열이 `suffixText` 로 끝나야 함         | `@suffix('.jpg') fileName!: string`                                                        |\n| `@length(value: number)`             | 문자열 길이가 정확히 `value` 여야 함          | `@length(6) otp!: string`                                                                  |\n| `@minLength(min: number)`            | 문자열 길이가 `min` 이상이어야 함             | `@minLength(8) password!: string`                                                          |\n| `@maxLength(max: number)`            | 문자열 길이가 `max` 이하이어야 함             | `@maxLength(20) username!: string`                                                         |\n| `@equal(value: any)`                 | 값이 `value` 와 정확히 일치해야 함           | `@equal('production') env!: string`                                                        |\n| `@notEqual(value: any)`              | 값이 `value` 와 달라야 함                | `@notEqual('admin') role!: string`                                                         |\n| `@isTrue()`                          | 값이 `true` 여야 함                    | `@isTrue() acceptedTerms!: boolean`                                                        |\n| `@isFalse()`                         | 값이 `false` 여야 함                   | `@isFalse() blocked!: boolean`                                                             |\n| `@oneOf(options: readonly any[])`    | 값이 `options` 중 하나여야 함             | `@oneOf(['credit','debit'] as const) method!: 'credit' \\| 'debit'`                         |\n| `@validate(validateFn, message?)`    | 커스텀 검증 함수를 사용                     | `@validate(v =\u003e typeof v === 'string' \u0026\u0026 v.includes('@'), 'invalid email') email!: string` |\n| `@regexp(pattern: RegExp, message?)` | 문자열이 주어진 정규식을 만족해야 함              | `@regexp(/^[0-9]+$/, 'digits only') phone!: string`                                        |\n| `@email()`                           | 값이 이메일 형식이어야 함                    | `@email() email!: string`                                                                  |\n\n## 라이선스\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyond-imagination%2Fexpress-cargo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyond-imagination%2Fexpress-cargo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyond-imagination%2Fexpress-cargo/lists"}