hype/examples/ssr/src/server/index.ts

16 lines
411 B
TypeScript

import { Hype } from '@because/hype'
const app = new Hype({})
// custom routes go here
// app.get("/my-custom-routes", (c) => c.text("wild, wild stuff"))
// SSE example: streams current time every second
app.sse('/api/time', (send) => {
send({ time: Date.now() })
const interval = setInterval(() => send({ time: Date.now() }), 1000)
return () => clearInterval(interval)
})
export default app.defaults