Skip to content

Commit 5b6e963

Browse files
committed
fix http problem details response structure
1 parent 0767557 commit 5b6e963

6 files changed

Lines changed: 14219 additions & 40 deletions

File tree

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ Create a `app.ts` file
4444
```typescript
4545
// Import API Gateway Event handler
4646
import { APIGatewayProxyEvent, Context } from 'aws-lambda';
47-
import { ApiGatewayResolver } from './ApiGateway';
48-
import { AsyncFunction, BaseProxyEvent, JSONData } from 'types';
47+
import {
48+
ApiGatewayResolver,
49+
AsyncFunction,
50+
BaseProxyEvent,
51+
JSONData,
52+
} from '@evernorth/aws-lambda-ts-event-handler';
4953

5054
// Initialize the event handler
5155
const app = new ApiGatewayResolver();
@@ -63,9 +67,17 @@ app.addRoute('GET', '/v1/hello', helloHandler as AsyncFunction);
6367
exports.handler = (
6468
_event: APIGatewayProxyEvent,
6569
_context: Context,
66-
): Promise<JSONData> =>
70+
): Promise<JSONData> => {
6771
// Resolve routes
68-
app.resolve(_event, _context);
72+
return app.resolve(_event, _context);
73+
};
74+
75+
// Declare your Lambda handler
76+
if (require.main === module) {
77+
LocalTestServer.getInstance(handler as Handler).start();
78+
} else {
79+
module.exports.handler = handler;
80+
}
6981
```
7082

7183
Run the application
@@ -124,9 +136,10 @@ export class HelloController {
124136
const handler = (
125137
_event: APIGatewayProxyEvent,
126138
_context: Context,
127-
): Promise<JSONData> =>
139+
): Promise<JSONData> => {
128140
// Resolve routes
129-
app.resolve(_event, _context);
141+
return app.resolve(_event, _context);
142+
};
130143

131144
// Declare your Lambda handler
132145
if (require.main === module) {

0 commit comments

Comments
 (0)