Skip to content

Commit bb66976

Browse files
committed
feat: update Hono server plugin to support sub-application mounting and improve API integration
1 parent f29687b commit bb66976

4 files changed

Lines changed: 37 additions & 1059 deletions

File tree

apps/docs/source.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { defineDocs, defineConfig, frontmatterSchema } from 'fumadocs-mdx/config';
22
import { z } from 'zod';
3-
import { fileURLToPath } from 'node:url';
43
import path from 'node:path';
54

6-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
7-
85
export const docs = defineDocs({
9-
dir: path.resolve(currentDir, '../../content/docs'),
6+
dir: path.resolve(process.cwd(), '../../content/docs'),
107
});
118

129
const blogSchema = frontmatterSchema.extend({
@@ -16,7 +13,7 @@ const blogSchema = frontmatterSchema.extend({
1613
});
1714

1815
export const blog = defineDocs({
19-
dir: path.resolve(currentDir, '../../content/blog'),
16+
dir: path.resolve(process.cwd(), '../../content/blog'),
2017
docs: {
2118
schema: blogSchema,
2219
},

packages/plugins/plugin-hono-server/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"dependencies": {
1313
"@hono/node-server": "^1.2.0",
1414
"@objectstack/core": "workspace:*",
15+
"@objectstack/hono": "workspace:*",
16+
"@objectstack/runtime": "workspace:*",
1517
"@objectstack/spec": "workspace:*",
1618
"@objectstack/types": "workspace:*",
1719
"hono": "^4.0.0"

packages/plugins/plugin-hono-server/src/adapter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ export class HonoHttpServer implements IHttpServer {
101101
}
102102
}
103103

104+
/**
105+
* Mount a sub-application or router
106+
*/
107+
mount(path: string, subApp: Hono) {
108+
this.app.route(path, subApp);
109+
}
110+
111+
104112
async listen(port: number) {
105113
return new Promise<void>((resolve) => {
106114
if (this.staticRoot) {

0 commit comments

Comments
 (0)