Skip to content

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-app
npm create hono@latest my-app
txt
yarn create hono my-app
yarn create hono my-app
txt
pnpm create hono my-app
pnpm create hono my-app
txt
bunx create-hono my-app
bunx create-hono my-app
txt
deno run -A npm:create-hono my-app
deno run -A npm:create-hono my-app

Move to my-app and install the dependencies.

txt
cd my-app
npm i
cd my-app
npm i
txt
cd my-app
yarn
cd my-app
yarn
txt
cd my-app
pnpm i
cd my-app
pnpm i
txt
cd my-app
bun i
cd my-app
bun i

3. 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.fetch

4. Run

Run the command.

ts
lagon dev src/index.ts
lagon dev src/index.ts

Then, 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.

Released under the MIT License.