title: Serverless Response Templates w/ Lambda Integration
body: <p>I've read the docs for serverless and AWS but I'm just not getting the response templates. I have a lambda function that calls another module and that module will return an object with an <code>info</code> and possibly an <code>error</code> property. If the error property exists, i want to throw an error and handle it with a response template in API Gateway.</p>
  <p>serverless.yml (not sure what goes in the <code>400 pattern</code>)</p>
  <pre><code>functions:
    onboard:
      handler: api/onboard.onboard
      events:
        - http:
            path: /onboard
            method: post
            integration: lambda
            request:
              passThrough: NEVER
              schema:
                application/json: ${file(models/onboard.schema.json)}
              template:
                application/json: $input.body
            response:
              200:
                pattern: ''
              400:
                pattern: '.*&quot;error&quot;.*' // WHAT GOES HERE???
                template: $input.path('$.errorMessage')
  </code></pre>
  <p>lambda</p>
  <pre><code>const onboard = async (event) =&gt; {
    // returns an object with info/error property
    const response = await someModule();
    /* example response
    const response = {
      error: 'some error',
      name: event.name
    };
    */
    
    if(response.error) {
      context.done(JSON.stringify(response));
    }
  
    return response;
  };
  </code></pre>