How to serve static file in deno? #2755
Unanswered
molystechie
asked this question in
Q&A
Replies: 1 comment
-
I believe the static folder needs to be in your root directory, not inside the src folder. Let me know and we can get the docs updated accordingly. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hi am in difficult time to work with static files, i read the doc but still not get it correctly
This from doc how to serve static file: https://hono.dev/getting-started/deno#serve-static-files
app.use('/static/*', serveStatic({ root: './' }))
app.use('/favicon.ico', serveStatic({ path: './favicon.ico' }))
folder structure
./
├── favicon.ico
├── index.ts
└── static
├── demo
│ └── index.html
├── fallback.txt
├── hello.txt
└── images
└── dinotocat.png
if in static directory i have js/script.ts, what would be its script in head?
favicon.svg dont show up, how to to put it correctly?
in HTML head
<title>${title}</title>
<script type="text/javascript" src="./js/script.ts" defer></script>
Beta Was this translation helpful? Give feedback.
All reactions