Giter Club home page Giter Club logo

Comments (6)

alxgrk avatar alxgrk commented on July 23, 2024

actually, we do not need to start the application locally, right? with this in mind, i removed the whole handler stuff from sample, so what's left to do for a user is to specify the ktor application and reference the LambdaAdapter::handle method in the serverless.yml.
should be very easy to use.

from ktor-server-lambda.

otbe avatar otbe commented on July 23, 2024

Looks great so far. I wonder if we can keep (parts of) the Handler.kt file just for local development purposes? I would really love to be able to start the API on my machine 🤗

from ktor-server-lambda.

alxgrk avatar alxgrk commented on July 23, 2024

Yeah, I would like that too :) what do you think about some configuration option when starting the app? E.g. declaring a constant in LambdaAdapter, that can be passed to the LambdaEngine from the main function, which in turn enables delegation to the CIO Engine? Something like this 😅

from ktor-server-lambda.

otbe avatar otbe commented on July 23, 2024

Im not quite sure about this 🤔I would like to keep it as simple as possible for us and the users. Correct me if Im wrong but if we keep Handler.kt until this line and rename it to something like Launcher.kt it should work without modifications of the LambdaAdapter/Engine, shouldnt it? Especially after your last changes to the LambdaAdapter.

from ktor-server-lambda.

alxgrk avatar alxgrk commented on July 23, 2024

the problem with the current LambdaEngine is, that the main thread won't be kept alive. If you run the main function, the program will be stopped after a short period of time.
If you have a deeper look into CIOEngine, you'll see that there are coroutines being started that stop the application from being shut down.

I think the question is: what do you want to test locally?
if it's only the ktor application itself, I would say it's enough to re-use the CIOEngine.
if you want to simulate the lambda environment, then we'll need to block in the LambdaEngine ourselves.

from ktor-server-lambda.

alxgrk avatar alxgrk commented on July 23, 2024

after talking to @otbe my confusion is now resolved and i simply re-added the original main function

from ktor-server-lambda.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.