Skip to content

Commit ac490af

Browse files
committed
fix review comments
1 parent 2862109 commit ac490af

11 files changed

Lines changed: 60 additions & 80 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# IntelliJ
55
/.idea
66
*.iml
7+
/lib
78

89
# Visual Studio Code
910
/.vscode

CONTRIBUTING.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
Contributing
1+
# Contributing
22

33
Thanks for your interest in contributing to this project!
44

5-
We welcome any kind of contribution, including:
5+
We welcome any kind of contribution including:
66

7-
Documentation
8-
Examples
9-
New features and feature requests
10-
Bug fixes
7+
- Documentation
8+
- Examples
9+
- New features and feature requests
10+
- Bug fixes
1111

12-
For small changes, open pull requests.
12+
Please open Pull Requests for small changes.
1313

14-
For larger changes, submit an issue that outlines the following:
14+
For larger changes please submit an issue with additional details.
1515

16-
The use case that your changes are applicable to.
17-
Steps to reproduce the issue(s) if applicable.
18-
A detailed description of what your changes would entail.
19-
Alternative solutions or approaches if applicable.
16+
This issue should outline the following:
17+
18+
- The use case that your changes are applicable to.
19+
- Steps to reproduce the issue(s) if applicable.
20+
- Detailed description of what your changes would entail.
21+
- Alternative solutions or approaches if applicable.

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[ aws-lambda-ts-lambda-handler ]
22

3-
Copyright (c) [ 2023 - 2025 ] Evernorth Strategic Development, Inc.
3+
Copyright (c) 2025 Evernorth Strategic Development, Inc.
44

55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.

README.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Minimalistic event handler & HTTP router for Serverless applications.
66

7-
`aws-lambda-ts-event-handler` is a lightweight and focusted Typescript library that brings elegant HTTP routing to AWS Lambda functions - without the overhead of traditional web frameworks.
7+
`aws-lambda-ts-event-handler` is a lightweight and focused Typescript library that brings elegant HTTP routing to AWS Lambda functions - without the overhead of traditional web frameworks.
88
Designed specifically for serverless workloads on AWS, this library enables developers to define clean and type-safe API routes using Typescript decorations.
99

1010
**Features**
@@ -23,16 +23,16 @@ See the [package.json](./package.json) file.
2323

2424
## Building from Source
2525

26-
For detailed instructions to build the project from source, please see [INSTALL](INSTALL.md) document. To add this library to your project, run
26+
For detailed instructions to build the project from source, please see [INSTALL](INSTALL.md) document.
27+
28+
## Installation
29+
30+
To add this library to your project, run
2731

2832
```shell
2933
npm install --save @evernorth/aws-lambda-ts-event-handler
3034
```
3135

32-
## Installation
33-
34-
Please see [INSTALL](INSTALL.md) document.
35-
3636
## Configuration
3737

3838
If the software is configurable, describe it in detail, either here or in other documentation to which you link.
@@ -81,7 +81,6 @@ const helloHandler = async (
8181
// Register Route
8282
app.addRoute("GET", "/v1/hello", helloHandler as AsyncFunction);
8383

84-
// Declare your Lambda handler
8584
// Declare your Lambda handler
8685
exports.handler = (
8786
_event: APIGatewayProxyEvent,
@@ -122,7 +121,7 @@ import {
122121
JSONData,
123122
Handler,
124123
LocalTestServer,
125-
} from "@cigna/aws-lambda-ts-event-handler";
124+
} from "@evernorth/aws-lambda-ts-event-handler";
126125

127126
// Initialize the event handler
128127
const app = new ApiGatewayResolver();
@@ -191,7 +190,7 @@ adds standard CORS headers to the response
191190
* Request completely sent off
192191
< HTTP/1.1 200 OK
193192
< Content-Type: application/json
194-
< Access-Control-Allow-Origin: *
193+
< Access-Control-Allow-Origin: * # For security, it is recommended to specify specific allow-listed domains.
195194
< Access-Control-Allow-Headers: Authorization,Content-Type,X-Amz-Date,X-Api-Key,X-Amz-Security-Token
196195
< content-length: 25
197196
< Date: Mon, 10 Mar 2025 20:47:29 GMT
@@ -202,17 +201,11 @@ adds standard CORS headers to the response
202201
{"message":"Hello World"}%
203202
```
204203

205-
## Known issues
206-
207-
Document any known significant shortcomings with the software.
208-
209-
## Getting help
210-
211-
If you have questions, concerns, bug reports, etc., file an issue in this repository's Issue Tracker.
204+
---
212205

213-
## Getting involved
206+
## Support
214207

215-
See the [CONTRIBUTING](CONTRIBUTING.md) file for info on how to get involved.
208+
If you have questions, concerns, bug reports, etc. See [CONTRIBUTING](CONTRIBUTING.md).
216209

217210
## License
218211

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
displayName: {
3-
name: 'Digital Typescript Library: EVENT-HANDLER',
3+
name: 'Evernorth Typescript Library: aws-lambda-ts-event-handler',
44
color: 'yellow',
55
},
66
'runner': 'groups',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@cigna/aws-lambda-ts-event-handler",
2+
"name": "@evernorth/aws-lambda-ts-event-handler",
33
"version": "0.0.1",
44
"description": "Minimalistic event handler & http router for Serverless applications",
55
"main": "./lib/index.js",

src/helpers/TestServer.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,18 @@ class LocalTestServer {
171171
res.write(body);
172172
} catch (error) {
173173
console.error('Error constructing response:', error);
174+
175+
// IETF RFC 9457 compliant error response
176+
const errorResponse = {
177+
type: 'about:blank',
178+
title: 'An unexpected error occurred while constructing the response.',
179+
status: 500,
180+
detail: `Error constructing response: ${error}`,
181+
};
182+
174183
res.statusCode = 500;
175-
res.write('Internal Server Error');
184+
res.setHeader('content-type', 'application/problem+json');
185+
res.write(JSON.stringify(errorResponse));
176186
} finally {
177187
res.end();
178188
}
@@ -194,8 +204,16 @@ class LocalTestServer {
194204
);
195205
} catch (error) {
196206
console.error('Error handling request:', error);
207+
208+
// IETF RFC 9457 compliant error response
209+
const errorResponse = {
210+
type: 'about:blank',
211+
title: 'An unexpected error occurred while handling the request.',
212+
status: 500,
213+
detail: `Error handling requestg/: ${error}`,
214+
};
197215
res.statusCode = 500;
198-
res.write('Internal Server Error');
216+
res.write(JSON.stringify(errorResponse));
199217
res.end();
200218
}
201219
},

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export * from './ApiGateway';
1+
export * from './ApiGatewayEventRouter';
22
export * from './helpers';
33
export * from './middleware';
44
export * from './types';

0 commit comments

Comments
 (0)