{"id":17930682,"url":"https://github.com/bcrikko/express-openapi-sample","last_synced_at":"2026-04-10T02:40:49.834Z","repository":{"id":93368295,"uuid":"88571821","full_name":"BcRikko/express-openapi-sample","owner":"BcRikko","description":"express-openapiを使ってRESTful APIを実装する","archived":false,"fork":false,"pushed_at":"2017-04-25T04:46:56.000Z","size":48,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T10:22:15.025Z","etag":null,"topics":["express","express-openapi","nodejs","openapi","typeorm","typescript"],"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/BcRikko.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},"funding":{"github":"BcRikko"}},"created_at":"2017-04-18T02:22:21.000Z","updated_at":"2020-08-05T07:30:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"e4a1ffaf-19cc-4d66-bee5-8560604b6493","html_url":"https://github.com/BcRikko/express-openapi-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BcRikko/express-openapi-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BcRikko%2Fexpress-openapi-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BcRikko%2Fexpress-openapi-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BcRikko%2Fexpress-openapi-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BcRikko%2Fexpress-openapi-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BcRikko","download_url":"https://codeload.github.com/BcRikko/express-openapi-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BcRikko%2Fexpress-openapi-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271036005,"owners_count":24688538,"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-08-18T02:00:08.743Z","response_time":89,"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","express-openapi","nodejs","openapi","typeorm","typescript"],"created_at":"2024-10-28T21:15:19.447Z","updated_at":"2026-04-10T02:40:44.802Z","avatar_url":"https://github.com/BcRikko.png","language":"TypeScript","funding_links":["https://github.com/sponsors/BcRikko"],"categories":[],"sub_categories":[],"readme":"express-openapi-sample\r\n====\r\n\r\nExpressのOpen API(旧Swagger)フレームワークを使って、Todoアプリをつくる\r\n\r\n## 使い方\r\n\r\nNode.jsはとりあずv6.0以上\r\n* node.js \u003e= v6.0\r\n\r\n### Install\r\n```sh\r\n$ npm install\r\n```\r\n\r\n### Build\r\n```sh\r\n$ npm run build\r\n```\r\n\r\n### Test\r\n```sh\r\n$ npm run test\r\n```\r\n\r\n\r\n## メモ\r\n\r\n### Open APIについて\r\n\r\nRESTful APIのインターフェイスを記述するフォーマット。\r\nexpress-oepnapiでは、`paths`部分を空にしてしまうので、オリジナルは[api_original.yml](./api_original.yml)を参照。\r\n\r\n* [OpenAPI Specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)\r\n* [express-openapi](https://github.com/kogosoftwarellc/express-openapi)\r\n\r\n\r\n### APIのパスについて\r\n\r\nAPIのベースパスは、[api.yml#L2](./api.yml#L2)部分で定義する。\r\nここで指定した`basePath`が`http://example.com/{basePath}/`のようになる。\r\n`api`だったり`1.0`のようなAPIバージョンを書くことが多い。\r\n\r\nエンドポイントは、`src/api`以下でファイル名やディレクトリ名がそのままパスになる。\r\n\r\n\r\n### ディレクトリについて\r\n\r\n```\r\n.src\r\n├── index.ts               // expressを起動させるためのコード\r\n├── Server.ts              // コア部分\r\n├── api.ts                 // レスポンス処理の共通処理\r\n├── api                    // APIパス（この配下がエンドポイントになっていく）\r\n│   ├── tasks              // basePath/tasks/...\r\n│   │   └── {id}.ts        // basePath/tasks/{id}\r\n│   └── tasks.ts           // basePath/tasks\r\n├── models\r\n│   ├── Task.ts            // Taskテーブルの定義\r\n│   └── TaskController.ts  // Taskテーブルを操作する\r\n└── store\r\n    └── index.ts           // データベースの設定\r\n```\r\n\r\n### バリデーションについて\r\n\r\n`src/api`で定義されている`apiDoc`により、pathやbodyパラメータのバリデーションが行われる。\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcrikko%2Fexpress-openapi-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcrikko%2Fexpress-openapi-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcrikko%2Fexpress-openapi-sample/lists"}