https://github.com/uki00a/fresh-mount
Mount Hono and Oak applications as Fresh routes.
https://github.com/uki00a/fresh-mount
fresh hono oak
Last synced: 6 months ago
JSON representation
Mount Hono and Oak applications as Fresh routes.
- Host: GitHub
- URL: https://github.com/uki00a/fresh-mount
- Owner: uki00a
- License: mit
- Created: 2024-02-28T11:08:33.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-02T13:42:40.000Z (about 2 years ago)
- Last Synced: 2025-03-06T09:28:26.630Z (about 1 year ago)
- Topics: fresh, hono, oak
- Language: TypeScript
- Homepage: https://deno.land/x/fresh_mount
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fresh-mount
Mount Hono and Oak applications as Fresh routes.
## Usage
### Mount Hono applications as Fresh routes
```typescript
// fresh.config.ts
import { defineConfig } from "$fresh/server.ts";
import { hono } from "https://deno.land/x/fresh_mount@$MODULE_VERSION/hono/mod.ts";
import { Hono } from "https://deno.land/x/hono/mod.ts";
const app = new Hono();
app.get("/", (c) => {
return c.text("Hello Hono!");
});
export default defineConfig({
plugins: [
// Mount a Hono application at `/api`
hono("/api", app),
],
});
```
### Mount Oak applications as Fresh routes
```typescript
// fresh.config.ts
import { defineConfig } from "$fresh/server.ts";
import { oak } from "https://deno.land/x/fresh_mount@$MODULE_VERSION/oak/mod.ts";
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
const router = new Router();
router
.get("/", (ctx) => {
ctx.response.body = "Hello Oak!";
});
app.use(router.routes());
app.use(router.allowedMethods());
export default defineConfig({
plugins: [
// Mount an Oak application at `/api`
oak("/api", app),
],
});
```
## Acknowledgement
This package is inspired by the following projects.
- [koa-mount](https://github.com/koajs/mount)