# Mock integration endpoint

**URL:** <https://forum.serverless.com/t/mock-integration-endpoint/1419>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [March 1, 2017, 8:17pm UTC](https://forum.serverless.com/t/mock-integration-endpoint/1419 "2017-03-01T20:17:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jeff-k-lee](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jeff-k-lee/32/2754_2.png) [@jeff-k-lee](https://forum.serverless.com/u/jeff-k-lee)\
**Post date:** [April 24, 2017, 11:56pm UTC](https://forum.serverless.com/t/mock-integration-endpoint/1419/2 "2017-04-24T23:56:14Z")

</div>

I took the HTTP proxy example and modified to implement MOCK integration until it matched what I wanted. I used the solution suggested here to pass in secrets: [Storing Database credentials securely](http://forum.serverless.com/t/storing-database-credentials-securely/1370/2)

If your method is anything other than a basic GET or POST, an OPTIONS method for CORS will also be needed.

```
resources:
  Resources:
    MockResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        ParentId:
          Fn::GetAtt:
            - ApiGatewayRestApi # our default Rest API logical ID
            - RootResourceId
        PathPart: yourpath # the endpoint in your API that is set as proxy
        RestApiId:
          Ref: ApiGatewayRestApi
    MockMethod:
      Type: AWS::ApiGateway::Method
      Properties:
        AuthorizationType: None
        HttpMethod: GET
        ResourceId:
          Ref: MockResource
        RestApiId:
          Ref: ApiGatewayRestApi
        MethodResponses:
          - ResponseModels:
              application/json: Empty
            ResponseParameters:
              method.response.header.Access-Control-Allow-Origin: true
            StatusCode: 200
        Integration:
          RequestTemplates:
            application/json: |
              {"statusCode": 200}
          Type: MOCK
          IntegrationResponses:
            - ResponseParameters:
                method.response.header.Access-Control-Allow-Origin: "'*'"
              ResponseTemplates:
                application/json: |
                  {
                    "number": 12345,
                    "data": {
                      "identitypool": "${self:custom.secrets.IDENTITYPOOL}",
                      "region": "${self:custom.secrets.REGION}",
                      "poolclient": "${self:custom.secrets.POOLCLIENT}",
                      "userpool": "${self:custom.secrets.USERPOOL}"
                    }
                  }
              StatusCode: 200
```

---

_[View the full topic](https://forum.serverless.com/t/mock-integration-endpoint/1419)._
