Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
xizeyoupan committed Sep 25, 2023
1 parent 6bf840b commit 5839404
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
31 changes: 29 additions & 2 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import app from "../app.js"
// import app from "../app.js"

async function writeReadableStreamToWritable(stream, writable) {
let reader = stream.getReader()
Expand Down Expand Up @@ -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以测试。'))
2 changes: 1 addition & 1 deletion node.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

1 comment on commit 5839404

@vercel
Copy link

@vercel vercel bot commented on 5839404 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.