-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhono.ts
35 lines (28 loc) · 817 Bytes
/
hono.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { serve } from '@hono/node-server'
import { Hono } from 'hono'
import { fileURLToPath } from "node:url"
import { dirname, join } from "node:path";
import { serveStatic } from '@hono/node-server/serve-static'
import { SiteRouter } from './server/hono/Routes/SiteRoutes';
const app = new Hono()
app.get(
'/react/*',
serveStatic({
root: `./`,
rewriteRequestPath: (path) => path.replace(/^\/react/, '/dist/react')
}))
app.get(
'/vue/*',
serveStatic({
root: `./`,
rewriteRequestPath: (path) => path.replace(/^\/vue/, '/dist/vue')
}))
app.route('/api/v1/sites', SiteRouter)
// app.route('/api/v1/compile', CompilerRouter)
// app.route('/api/v1/products', ProductRouter)
const port = 3000
console.log(`Server is running on port ${port}`)
serve({
fetch: app.fetch,
port
})