TotalTechGeek / elysia-lambda

A plugin for Elysia to deploy to AWS Lambda
MIT License
30 stars 1 forks source link

Plugin redundant? #3

Closed awilderink closed 1 year ago

awilderink commented 1 year ago

With the bun runtime on AWS already transforming the Gateway request to a native Request, isn't it just easier to use app.handle(request)?

// lambda.ts
import { Elysia } from "elysia";

const app = new Elysia()
  .get("/", () => {
    return new Response("Hello World!")
  });

export default {
  fetch(request: Request) {
    return app.handle(request);
  }
}

Please correct me if I'm wrong.

TotalTechGeek commented 1 year ago

Hey!

Most of the code for the plugin isn't for setting up that touch point, although this signature has changed a few times between editions of Elysia.

export default {
  fetch(request: Request) {
    return app.handle(request);
  }
}

Most of the plugin's code (and there isn't much of it) is set up around making it easier for users to set up the custom layer and perform some simple deployments.

It's also meant to stay out of your way when you're not deployed on Lambda, so that you can run your code locally / package it into containers without needing to change anything.

sandys commented 1 year ago

It's also meant to stay out of your way when you're not deployed on Lambda, so that you can run your code locally / package it into containers without needing to change anything.

@TotalTechGeek sorry to reply to an older thread, but can u mention how to use this plugin and get both options:

  1. package into docker containers for local running
  2. aws lambda deploy