FAQ
How is it different from Hono?
Server JS attempts to run your code unmodified in all runtimes. With Hono you need to change the code for different runtimes:
// Server JS code for Node.js, Bun and Netlify
import server from "@server/next";
export default server().get("/", () => "Hello server!");// Hono code for Node.js
import { serve } from "@hono/node-server"
import { Hono } from "hono"
const app = new Hono()
app.get('/', (c) => c.text('Hello Node.js!'))
serve(app)
// Hono code for Bun
import { Hono } from "hono"
const app = new Hono()
app.get('/', (c) => c.text('Hello Bun!'))
export default app
// Hono code for Netlify
import { Hono } from "jsr:@hono/hono"
import { handle } from "jsr:@hono/hono/netlify"
const app = new Hono()
app.get('/', (c) => c.text('Hello Hono!'))
export default handle(app)How do I render HTML templates?
Server JS has no built-in template engine; render the string yourself and send it with type('html'), which is what marks it as markup. A returned string is always text/plain, since guessing from its contents would serve user input as a page. See Templates for EJS, Pug and Handlebars examples, or JSX on Bun, which types itself.