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 6c80c3a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
33 changes: 31 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,33 @@ const getRequestListener = (fetchCallback) => {
}
}

export default getRequestListener(app.fetch)
// export default getRequestListener(app.fetch)

import api from '../src/service/api.js'
import { Hono } from 'hono'
import { handle } from 'hono/vercel'

export const config = {
runtime: 'edge',
}

const app = new Hono()
app.get('/', (c) => c.json({ message: 'Hello Hono!' }))
app.get('/api', api)


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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"major": "npm version major && git push origin main && git push origin --tags"
},
"engines": {
"node": ">=18.0.0"
"node": ">=18.0.0 <18.15.0"
},
"type": "module",
"author": "xizeyoupan",
Expand Down

0 comments on commit 6c80c3a

Please sign in to comment.