mirror of
https://github.com/Dokploy/templates.git
synced 2026-07-05 14:05:31 +02:00
28 lines
542 B
TypeScript
28 lines
542 B
TypeScript
import { serve } from '@hono/node-server'
|
|
import { Hono } from 'hono'
|
|
import { serveStatic } from '@hono/node-server/serve-static'
|
|
|
|
const app = new Hono()
|
|
|
|
app.use('*', async (c, next) => {
|
|
await next()
|
|
})
|
|
|
|
app.use('/templates/*', serveStatic({
|
|
root: '../templates',
|
|
rewriteRequestPath: (path) => {
|
|
return path.replace('/templates/', '')
|
|
}
|
|
}))
|
|
|
|
app.get('/', (c) => {
|
|
return c.text('Hello Hono!')
|
|
})
|
|
|
|
serve({
|
|
fetch: app.fetch,
|
|
port: 4000
|
|
}, (info) => {
|
|
console.log(`Server is running on http://localhost:${info.port}`)
|
|
})
|