Reputation: 55
Is there a way to send JSON body as response for 'GET' method in AWS API Gateway without using AWS Lambda. Here JSON is constant. It will be same every time this 'GET' method is called that why I don't want create a Lambda for that.
Upvotes: 2
Views: 1438
Reputation: 55
this.restApi.root.addResource("test").addMethod("GET", new MockIntegration({
requestTemplates: {
'application/json': `{"statusCode" : 200}`
},
integrationResponses: [
{
statusCode: '200',
responseTemplates: { 'application/json': `{"name": "John"}` }
}
]
}), {
methodResponses: [
{
statusCode: '200',
responseModels: { 'application/json': Model.EMPTY_MODEL }
}
]
});
Upvotes: 3
Reputation: 2777
Yes, your use case is ideal for mock API integration - https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-mock-integration.html
Upvotes: 2