{"id":23066918,"url":"https://github.com/dvsa/cvs-svc-minimum-application-version","last_synced_at":"2025-04-03T09:13:58.904Z","repository":{"id":216122697,"uuid":"734302768","full_name":"dvsa/cvs-svc-minimum-application-version","owner":"dvsa","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-24T10:14:33.000Z","size":739,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"develop","last_synced_at":"2024-10-25T01:57:33.167Z","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/dvsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2023-12-21T10:54:10.000Z","updated_at":"2024-03-26T08:30:53.000Z","dependencies_parsed_at":"2024-01-11T11:45:07.702Z","dependency_job_id":"731fc47c-c913-44ae-b2a5-2421472fd60e","html_url":"https://github.com/dvsa/cvs-svc-minimum-application-version","commit_stats":null,"previous_names":["dvsa/cvs-svc-minimum-app-version","dvsa/cvs-svc-minimum-application-version"],"tags_count":615,"template":false,"template_full_name":"dvsa/dvsa-lambda-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fcvs-svc-minimum-application-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fcvs-svc-minimum-application-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fcvs-svc-minimum-application-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvsa%2Fcvs-svc-minimum-application-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvsa","download_url":"https://codeload.github.com/dvsa/cvs-svc-minimum-application-version/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246970323,"owners_count":20862509,"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":[],"created_at":"2024-12-16T05:15:33.910Z","updated_at":"2025-04-03T09:13:58.881Z","avatar_url":"https://github.com/dvsa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lambda-starter\n\nA starting pattern for AWS lambda in Typescript \n\n**Requirements**\n\n- node v16.17.1 (Note if still using node 14 please checkout tag 1.0.0 and consider upgrading your runtime)\n- [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)\n- npm 8+\n\n**Prerequisites**\n- Create a `.env`\n    ```shell\n    cp .env.example .env\n    ```\n\n**Build**\n\n- `npm i`\n- `npm run build:dev`\n\n**Watch**\n\nTo watch for changes and automatically trigger a new build:\n- `npm run watch:dev`\n\n\n**Run Lambdas Locally**\n\n- Build the files first\n- `npm run start:dev`\n- To ensure that the lambdas have been successfully served, run the following command in a separate terminal:\n    - `curl --request GET http://localhost:3000/?message=hello%20world`\n    - the response should be: `{\"queryParams\": {\"message\": \"hello world\"}}`\n- To run CloudWatch Event lambdas: `npm run invoke -- CloudWatchEventLambdaFunction`\n\n\n**Debug Lambdas Locally (VS Code only)**\n\n- Run lambdas in debug mode: `npm run start:dev -- -d 5858`\n- Add a breakpoint to the lambda being tested (`src/handler/get.ts`)\n- Run the debug config from VS Code that corresponds to lambda being tested (`GetLambdaFunction`)\n- Send an HTTP request to the lambda's URI (`curl --request GET http://localhost:3000/?message=hello%20world`)\n- To debug CloudWatch Event lambdas: `npm run invoke -- CWEventLambdaFunction -d 5858`\n\n\n**Tests**\n\n- The [Jest](https://jestjs.io/) framework is used to run tests and collect code coverage\n- To run the tests, run the following command within the root directory of the project: `npm test`\n- Coverage results will be displayed on terminal and stored in the `coverage` directory\n    - The coverage requirements can be set in `jest.config.js`\n\n\n**Logging**\nLogging is handled by `https://github.com/winstonjs/winston`. A pre-configured logger is available, and can be used like so:\n\n```ts\nimport logger from \"../utils/logger\";\n\nlogger.info('Hello world');\nlogger.error('Hello world');\nlogger.warn('Hello world');\n```\n\n**Tip:** It's usually a good idea to attach the `requestId` and any `X-Correlation-Id` to the logger object's meta data so every log message will contain these useful bits of information.\n\n```ts\n  const event: APIGatewayProxyEvent = currentInvoke.event as APIGatewayProxyEvent;\n  const correlationId: string = event.headers['X-Correlation-Id'] || (currentInvoke.context as Context).awsRequestId;\n\n  const { requestId } = event.requestContext;\n\n  req.app.locals.correlationId = correlationId;\n  req.app.locals.requestId = requestId;\n\n  Logger.defaultMeta = { requestId, correlationId };\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvsa%2Fcvs-svc-minimum-application-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvsa%2Fcvs-svc-minimum-application-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvsa%2Fcvs-svc-minimum-application-version/lists"}