{"id":24755172,"url":"https://github.com/gravity-ui/expresskit","last_synced_at":"2026-03-03T09:01:53.282Z","repository":{"id":104912585,"uuid":"586287210","full_name":"gravity-ui/expresskit","owner":"gravity-ui","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-02T22:36:28.000Z","size":1197,"stargazers_count":8,"open_issues_count":6,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-03T00:43:19.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/gravity-ui.png","metadata":{"files":{"readme":"README-ru.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","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":"2023-01-07T15:53:55.000Z","updated_at":"2026-03-02T22:34:54.000Z","dependencies_parsed_at":"2024-10-24T20:37:23.678Z","dependency_job_id":"7d14915c-3506-4eca-86fe-765fa493a28f","html_url":"https://github.com/gravity-ui/expresskit","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/gravity-ui/expresskit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravity-ui%2Fexpresskit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravity-ui%2Fexpresskit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravity-ui%2Fexpresskit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravity-ui%2Fexpresskit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gravity-ui","download_url":"https://codeload.github.com/gravity-ui/expresskit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gravity-ui%2Fexpresskit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30035523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T06:58:30.252Z","status":"ssl_error","status_checked_at":"2026-03-03T06:58:15.329Z","response_time":61,"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":"2025-01-28T12:36:46.955Z","updated_at":"2026-03-03T09:01:53.240Z","avatar_url":"https://github.com/gravity-ui.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExpressKit\n\n`ExpressKit` — легковесная обертка для [express.js](https://expressjs.com/), которая интегрируется с [NodeKit](https://github.com/gravity-ui/nodekit), обеспечивая такие функции, как логирование запросов, поддержка трассировки, асинхронные контроллеры и middleware, а также детальное описание маршрутов.\n\nУстановка:\n\n```bash\nnpm install --save @gravity-ui/nodekit @gravity-ui/expresskit\n```\n\nОсновное использование:\n\n```typescript\nimport {ExpressKit} from '@gravity-ui/expresskit';\nimport {NodeKit} from '@gravity-ui/nodekit';\n\nconst nodekit = new NodeKit();\n\nconst app = new ExpressKit(nodekit, {\n  'GET /': (req, res) =\u003e {\n    res.send('Hello World!');\n  },\n});\n\napp.run();\n```\n\n## CSP (политика безопасности контента)\n\n`config.ts`\n\n```typescript\nimport type {AppConfig} from '@gravity-ui/nodekit';\nimport {csp} from '@gravity-ui/expresskit';\n\nconst config: Partial\u003cAppConfig\u003e = {\n    expressCspEnable: true,\n    expressCspPresets: ({getDefaultPresets}) =\u003e {\n        return getDefaultPresets({defaultNone: true}).concat([\n            csp.inline(),\n            {csp.directives.REPORT_TO: 'my-report-group'},\n        ]);\n    },\n    expressCspReportTo: [\n        {\n            group: 'my-report-group',\n            max_age: 30 * 60,\n            endpoints: [{ url: 'https://cspreport.com/send'}],\n            include_subdomains: true,\n        }\n    ]\n}\n\nexport default config;\n```\n\n## Управление кешированием\n\nПо умолчанию ExpressKit устанавливает `no-cache` заголовки на все ответы. Вы можете управлять этим поведением глобально или на уровне маршрута.\n\n### Глобальная конфигурация\n\n```typescript\nconst config: Partial\u003cAppConfig\u003e = {\n  expressEnableCaching: true, // Разрешить кеширование по умолчанию\n};\n```\n\n### Конфигурация на уровне маршрута\n\n```typescript\nconst app = new ExpressKit(nodekit, {\n  'GET /api/cached': {\n    enableCaching: true, // Разрешить кеширование для этого маршрута\n    handler: (req, res) =\u003e res.json({data: 'кешируемые'}),\n  },\n  'GET /api/fresh': {\n    enableCaching: false, // Принудительно no-cache\n    handler: (req, res) =\u003e res.json({data: 'всегда свежие'}),\n  },\n});\n```\n\nНастройка `enableCaching` на уровне маршрута переопределяет глобальную. Состояние доступно в `req.routeInfo.enableCaching`.\n\n## Валидация запросов и сериализация ответов\n\n- [Валидация запросов и сериализация ответов](https://github.com/gravity-ui/expresskit/blob/main/docs/VALIDATOR-ru.md) - использование zod для автоматической валидации запросов и сериализации ответов.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgravity-ui%2Fexpresskit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgravity-ui%2Fexpresskit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgravity-ui%2Fexpresskit/lists"}