This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
- import handleGetRequest from './handlers/get'
2
1
import * as aws from 'aws-lambda'
2
+ import handleGetRequest from './handlers/get'
3
3
import handlePostRequest from './handlers/post'
4
4
import handleOptionsRequest from './handlers/options'
5
5
@@ -57,6 +57,10 @@ export async function handle (event: aws.APIGatewayEvent, context: aws.Context)
57
57
body = { message : 'Unsupported Method.' }
58
58
break
59
59
}
60
+ body = {
61
+ success : true ,
62
+ data : body
63
+ }
60
64
} catch ( err ) {
61
65
if ( err . isBoom ) {
62
66
statusCode = err . output . statusCode
@@ -69,9 +73,15 @@ export async function handle (event: aws.APIGatewayEvent, context: aws.Context)
69
73
console . error ( `Error occurred: ${ err . message as string } ` )
70
74
console . error ( err . stack )
71
75
statusCode = 500
72
- body = { message : 'Internal Server Error' }
76
+ body = {
77
+ success : false ,
78
+ message : 'Internal Server Error'
79
+ }
73
80
}
74
81
}
75
-
76
- return { statusCode, headers, body : body ? JSON . stringify ( body ) : body }
82
+ return {
83
+ statusCode,
84
+ headers,
85
+ body : body ? JSON . stringify ( body ) : body
86
+ }
77
87
}
You can’t perform that action at this time.
0 commit comments