From 5839404e16a09caeb0a9af11edafb872ef9632dd Mon Sep 17 00:00:00 2001 From: xizeyoupan <44920131+xizeyoupan@users.noreply.github.com> Date: Mon, 25 Sep 2023 21:16:48 +0800 Subject: [PATCH] test --- api/index.js | 31 +++++++++++++++++++++++++++++-- node.js | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/api/index.js b/api/index.js index ab8fc40..ec84f19 100644 --- a/api/index.js +++ b/api/index.js @@ -1,4 +1,4 @@ -import app from "../app.js" +// import app from "../app.js" async function writeReadableStreamToWritable(stream, writable) { let reader = stream.getReader() @@ -95,4 +95,31 @@ const getRequestListener = (fetchCallback) => { } } -export default getRequestListener(app.fetch) +// export default getRequestListener(app.fetch) + + +import { Hono } from 'hono' +import { handle } from 'hono/vercel' + +export const config = { + runtime: 'edge', +} + +const app = new Hono().basePath('/api') +app.get('/', (c) => c.json({ message: 'Hello Hono!' })) + +export default handle(app) + +// import api from '../src/service/api.js' +// import { handler } from '../src/template.js' +// import { Hono } from 'hono' +// import { logger } from 'hono/logger' +// import { cors } from 'hono/cors' +// import { handle } from 'hono/vercel' + +// const app = new Hono() +// app.use('*', cors()) +// app.use('*', logger()) +// app.get('/api', api) +// app.get('/test', handler) +// app.get('/', (c) => c.text('你好!访问/test以测试。')) \ No newline at end of file diff --git a/node.js b/node.js index 7723588..b64b243 100644 --- a/node.js +++ b/node.js @@ -1,4 +1,4 @@ -import { handler } from './src/template.js' +import { handler } from './src/template' import config from './src/config.js' import api from './src/service/api.js' import { Hono } from 'hono'