title: How to create a CRUD API on Amazon Lambda using Micronaut
body: <p>I want to create a CRUD API using Micronaut and deploy it on AWS Lambda, exposing the different methods with Amazon API Gateway. I could create different Kotlin Projects per endpoint (GET, POST...), one including one function, but that's kind of cumbersome so I'd rather have a single project with all the CRUD functions.</p>
  
  <p>My current application contains two functions: one Supplier (GET) and one Consumer (POST).</p>
  
  <p><strong>Application:</strong> </p>
  
  <pre><code>object Application {
          @JvmStatic
          fun main(args: Array&lt;String&gt;) {
              Micronaut.build()
                      .packages("micronaut.aws.poc")
                      .mainClass(Application.javaClass)
                      .start()
          }
  }
  </code></pre>
  
  <p><strong>Supplier:</strong></p>
  
  <pre><code>@FunctionBean("micronaut-aws-poc")
  class MicronautAwsPocFunction : Supplier&lt;String&gt; {
  
      override fun get(): String {
          println("GET")
          return "micronaut-aws-poc"
      }
  }
  </code></pre>
  
  <p><strong>Consumer:</strong></p>
  
  <pre><code>@FunctionBean("micronaut-aws-poc-post")
  class MicronautAwsPocPostFunction : Consumer&lt;String&gt; {
  
      override fun accept(t: String) {
          println("POST $t")
      }
  
  }
  </code></pre>
  
  <p>Then, I have created a resource in Amazon API Gateway with one GET and one POST method. The problem is, no matter which one I call, the MicronautAwsPocFunction is always invoked.</p>
  
  <ol>
  <li>Is it possible/recommended to embed many functions in a single jar?</li>
  <li>How can I make POST invocations call the MicronautAwsPocPostFunction instead of the MicronautAwsPocFunction?</li>
  <li>In case I wanted an additional PUT function, how could I model it?</li>
  </ol>