Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lagon runtime support #734

Closed
QuiiBz opened this issue Dec 18, 2022 · 7 comments · Fixed by #742
Closed

Lagon runtime support #734

QuiiBz opened this issue Dec 18, 2022 · 7 comments · Fixed by #742

Comments

@QuiiBz
Copy link
Contributor

QuiiBz commented Dec 18, 2022

Hello! I would like to discuss how we can land Lagon support on Hono. It's an open-source runtime and platform specifically made for the edge, similar to CF Workers / Deno Deploy, bootstrapped and driven by the community.

Some notes:

You can already test locally using the CLI (npm i -g @lagon/cli, and feel free to DM me if you want to try the cloud version), here is an example of the "Hello World" showcased on the website and adapter for Lagon:

import { Hono } from 'hono'

const app = new Hono()
app.get('/', (c) => c.text('Hello! Hono!'))

export const handler = app.fetch
@yusukebe
Copy link
Member

Hi @QuiiBz !

Ultra cool!! It works on my machine!! Yes, let's go ahead.

SS

SS

@QuiiBz
Copy link
Contributor Author

QuiiBz commented Dec 18, 2022

Cool! Do you have a test suite that we could use to run Lagon on? I would happily create a PR at https://github.com/honojs/honojs.dev to add some documentation.

@yusukebe
Copy link
Member

@QuiiBz

This example covers some features.

https://github.com/honojs/examples/tree/main/basic

And we should write in the documentation which built-in middleware is supported on Lagon.

https://honojs.dev/docs/builtin-middleware/

So, I think the next step is to try running the middleware.

By the way, is there a way to easily test Lagon applications? For example, we use jest with jest-environment-miniflare for Cloudflare Workers and the deno test command for Deno.

@yusukebe yusukebe mentioned this issue Dec 19, 2022
51 tasks
@QuiiBz
Copy link
Contributor Author

QuiiBz commented Dec 20, 2022

Currently, there is no lagon test command built-in. We can't use a jest environment, because the code will still run inside Node. I see two options for this:

  • Create a lagon test command that will wrap your code inside a handler function and run it (but I'm not sure if we can bundle Jest inside a non-node environment)
  • Use lagon dev and perform HTTP queries on the dev server to check for proper responses (similar to the test in the example mentioned above)

I'll try each built-in middleware and see if there are any issues.

@QuiiBz
Copy link
Contributor Author

QuiiBz commented Dec 20, 2022

Update on middlewares, I've tested most of the feature and middlewares built-in into Hono, using lagon dev and running Jest to make HTTP requests on the Lagon dev server:

  • The ETag middleware isn't working because CryptoSubtle#digest doesn't supports SHA-1 yet Add SHA-1 to CryptoSubtle#digest lagonapp/lagon#400
  • The Cache middleware isn't working because the Cache API has not been implemented yet Cache API lagonapp/lagon#401
  • The serve static middleware is useless in Lagon. You can specify an assets directory (defaults to public if exists) using -p <directory>/--public <directory> to serve static assets

@yusukebe
Copy link
Member

@QuiiBz Thanks!

If so, you can write the documentation on the website. Please specify that some middleware doesn't work as you have looked into it. I think it's good that you place it after the Bun section in "Getting Started".

SS

PR is always welcome.

@yusukebe
Copy link
Member

And about the test. This is just a request. I think lagon test command or a jest environment would be great for the developer. Including me:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants