{"id":21377221,"url":"https://github.com/softchef/cdk-restapi","last_synced_at":"2025-07-13T10:31:25.259Z","repository":{"id":37051428,"uuid":"368499653","full_name":"SoftChef/cdk-restapi","owner":"SoftChef","description":"This construct is base on @aws/aws-apigateway.RestApi.  The RestApi has addResource \u0026 addMethod function to create REST API routes. But the source code are low readability about what kind of resources and method in the API. So this construct are redefine the resources to improve readability.","archived":false,"fork":false,"pushed_at":"2022-11-10T14:55:32.000Z","size":3258,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T09:03:14.096Z","etag":null,"topics":["api-gateway","cdk","elb","fargate","lambda","restapi"],"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/SoftChef.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":"2021-05-18T11:09:48.000Z","updated_at":"2024-01-19T11:50:09.000Z","dependencies_parsed_at":"2023-01-20T14:30:16.708Z","dependency_job_id":null,"html_url":"https://github.com/SoftChef/cdk-restapi","commit_stats":null,"previous_names":[],"tags_count":464,"template":false,"template_full_name":null,"purl":"pkg:github/SoftChef/cdk-restapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftChef%2Fcdk-restapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftChef%2Fcdk-restapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftChef%2Fcdk-restapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftChef%2Fcdk-restapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SoftChef","download_url":"https://codeload.github.com/SoftChef/cdk-restapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftChef%2Fcdk-restapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265128233,"owners_count":23715621,"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","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":["api-gateway","cdk","elb","fargate","lambda","restapi"],"created_at":"2024-11-22T09:19:37.275Z","updated_at":"2025-07-13T10:31:24.917Z","avatar_url":"https://github.com/SoftChef.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CDK with RestApi\n\n[![npm version](https://badge.fury.io/js/%40softchef%2Fcdk-restapi.svg)](https://badge.fury.io/js/%40softchef%2Fcdk-restapi)\n![Release](https://github.com/SoftChef/cdk-restapi/workflows/Release/badge.svg)\n![npm](https://img.shields.io/npm/dt/@softchef/cdk-restapi?label=NPM%20Downloads\u0026color=orange)\n\nThis construct is base on @aws/aws-apigateway.RestApi.\n\nThe RestApi has addResource \u0026 addMethod function to create REST API routes. But the source code are low readability about what kind of resources and method in the API. So this construct are redefine the resources to improve readability.\n\n## Installation\n\n```\n  npm install @softchef/cdk-restapi\n  // or\n  yarn add @softchef/cdk-restapi\n```\n\n## Example\n```\nconst demoRestApi = new RestApi(stack, 'RestApiDemo', {\n  resources: [\n    {\n      path: '/articles',\n      httpMethod: HttpMethod.GET,\n      lambdaFunction: new lambda.NodejsFunction(stack, 'GetArticles', {\n        entry: `./lambda-assets/articles/get-articles/app.ts`,\n      }),\n    },\n    {\n      path: '/articles',\n      httpMethod: HttpMethod.POST,\n      lambdaFunction: new lambda.NodejsFunction(stack, 'CreateArticle', {\n        entry: `./lambda-assets/articles/create-article/app.ts`,\n      }),\n    },\n    {\n      path: '/articles/{articleId}',\n      httpMethod: HttpMethod.GET,\n      lambdaFunction: new lambda.NodejsFunction(stack, 'GetArticle', {\n        entry: `./lambda-assets/articles/get-article/app.ts`,\n      }),\n    },\n    {\n      path: '/articles/{articleId}',\n      httpMethod: HttpMethod.PUT,\n      lambdaFunction: new lambda.NodejsFunction(stack, 'UpdateArticle', {\n        entry: `./lambda-assets/articles/update-article/app.ts`,\n      }),\n    },\n    {\n      path: '/articles/{articleId}/comments',\n      httpMethod: HttpMethod.GET,\n      lambdaFunction: new lambda.NodejsFunction(stack, 'GetComments', {\n        entry: `./lambda-assets/articles/get-comments/app.ts`,\n      }),\n    },\n    {\n      path: '/articles/{articleId}/comments',\n      httpMethod: HttpMethod.POST,\n      lambdaFunction: new lambda.NodejsFunction(stack, 'CreateComment', {\n        entry: `./lambda-assets/articles/create-comment/app.ts`,\n      }),\n    },\n  ],\n  enableCors: true,\n});\n\n// Add multi-resources\ndemoRestApi.addResources([\n  {\n    path: '/authors',\n    httpMethod: HttpMethod.GET,\n    lambdaFunction: new lambda.NodejsFunction(stack, 'GetAuthors', {\n      entry: `./lambda-assets/authors/get-authors/app.ts`,\n    }),\n  },\n  {\n    path: '/authors/{authorId}',\n    httpMethod: HttpMethod.GET,\n    lambdaFunction: new lambda.NodejsFunction(stack, 'GetAuthor', {\n      entry: `./lambda-assets/authors/get-author/app.ts`,\n    }),\n  }\n]);\n\n// Add single resource\ndemoRestApi.addResource({\n  path: '/authors',\n  httpMethod: HttpMethod.POST,\n  lambdaFunction: new lambda.NodejsFunction(stack, 'CreateAuthors', {\n    entry: `./lambda-assets/authors/create-authors/app.ts`,\n  }),\n})\n\n```\n\n\n\n### Demo\n\n1. Clone this repository\n2. Run commands\n```\nnpx projen\ncdk deploy --app lib/demo/demo.js\n```\n3. Checkout the CloudFormation stacks and API Gateway\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftchef%2Fcdk-restapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftchef%2Fcdk-restapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftchef%2Fcdk-restapi/lists"}