An open API service indexing awesome lists of open source software.

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.

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)