Lagon
Lagon is an open source runtime and platform to run TypeScript and JavaScript Functions at the Edge. It's neither Node.js nor Deno.
Note that some middlewares don't work or are useless.
1. Install
First, install the Lagon CLI. Please refer to the official documentation.
2. Setup
A starter for Lagon is available. Start your project with "create-hono" command.
txt
npm create hono@latest my-appnpm create hono@latest my-apptxt
yarn create hono my-appyarn create hono my-apptxt
pnpm create hono my-apppnpm create hono my-apptxt
bunx create-hono my-appbunx create-hono my-apptxt
deno run -A npm:create-hono my-appdeno run -A npm:create-hono my-appMove to my-app and install the dependencies.
txt
cd my-app
npm icd my-app
npm itxt
cd my-app
yarncd my-app
yarntxt
cd my-app
pnpm icd my-app
pnpm itxt
cd my-app
bun icd my-app
bun i3. Hello World
Edit src/index.ts like below.
ts
// src/index.ts
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Lagon!'))
export const handler = app.fetch// src/index.ts
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => c.text('Hello Lagon!'))
export const handler = app.fetch4. Run
Run the command.
ts
lagon dev src/index.tslagon dev src/index.tsThen, access http://localhost:1234 in your browser.
Limitations
- The "Cache" middleware isn't supported yet
Serve static files
Lagon serves your static files using the public directory by default.
Hono