-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
34 lines (29 loc) · 981 Bytes
/
main.ts
File metadata and controls
34 lines (29 loc) · 981 Bytes
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
import "dotenv/config"
import "reflect-metadata"
// import { serveStatic } from 'hono/bun'
import { serveStatic } from '@hono/node-server/serve-static'
import { bootstrap } from "./src/application";
import { NotFoundException } from "@/app/libs/error";
function main() {
const { app, port } = bootstrap.AppServer.InitailizeApplication()!
app.get(
'/_static/*',
serveStatic({
root: './',
rewriteRequestPath: (path) => {
console.log(path.replace(/^\/_static/, '/public'))
return path.replace(/^\/_static/, '/public')
},
onNotFound: (path, c) => {
c.redirect('/_static/404.html')
},
})
)
app.use('/favicon.ico', serveStatic({
path: './public/favicon.ico', onNotFound: (path, c) => {
throw new NotFoundException()
},
}))
return { port, fetch: app.fetch }
}
export default main()