-
|
The #38 was merged and introduced from What is the best way to start a custom server entry? Code
import { Hono } from 'hono'
import { apply, serve } from '@photonjs/hono'
const port = +(process.env.PORT || 3000)
function startServer() {
const app = new Hono()
apply(app)
return serve(app, { port })
}
export default startServer()Draftimport { createServer } from "node:http"
import serverStarted from '/server/index.ts'
const { port } = serverEntry.server!.options!
const server = createServer(serverEntry.server!.nodeHandler!)
server.listen(port, () => {
console.log(`Server running at http://localhost:${port}`)
})Going to Related |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
After |
Beta Was this translation helpful? Give feedback.
After
@photonjs/hono>= 0.1.7,serve()returns aServeReturnobject instead of starting the server directly. The server is now started by@photonjs/runtime/serve.ts. Simply export the result fromserve():export default serve(app, { port })- do NOT manually call startServer() or extract nodeHandler.