Mohammed
Mohammed
Explore posts from servers
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Aight, thanks. Need to come back later to revisit it. Brain capacity doesn't allow it at the moment
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Guess it's the exact opposite of what I was thinking haha
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Why does this not work? app.use("/static/*", serverStatic({ root: "./static"})) If my file is in /static/assets/myfile.txt Then my expectation was that I can cut the /static from he URL and access it like /assets/myfile.txt
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Damns son, paths are complicated
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
So if my URL is /static/someFile.txt it should be available at URL /someFile.txt ?
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
How I understand it is: app.use("static/*" should resolve all files for URLs starting with /static and serveStatic({root: "./static"}) means it should start looking for the files in the /static directory
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Probably I'm just misunderstanding how it's supposed to work
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
If I do this: app.use("/static/*", serveStatic({ root: "./"})) I can access the file via this URL /static/assets/myscript.js
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Then I want to access the file via this URL: /static/myscript.js also tried /static/assets/myscript.js
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
app.use("/static/*", serveStatic({ root: "./static"})) is what I use to set the root
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Getting 404s
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
What else do you need?
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Just trying to serve a js file statically. (also tried serving an html file for testing)
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
There's nothing else going on. I only created a fresh project so it's all very isolated
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Btw I also tried accessing it via /static/assets/myscript.js when only setting root, didn't work either
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
Hmm, could that mean that root is not being set?
37 replies
HHono
Created by Mohammed on 5/9/2025 in #help
Can't get serveStatic to work with `root`
I'm using bun
37 replies
DDeno
Created by Mohammed on 3/22/2025 in #help
Confusing linting
No idea why that would happen, I installed the package with deno add and it's in my deno.json file
3 replies
DDeno
Created by Mohammed on 3/22/2025 in #help
Confusing linting
I'm getting an error earlier in the code: ts: Cannot find module 'module name' or its corresponding type declarations So I guess that's the root of the problem.
3 replies
DDeno
Created by Mohammed on 9/29/2024 in #help
How to specify unstable fmt options?
Just FYI, the deno settings for indentation size and tabs/spaces don't really seem to take precedence in vscode. Was still necessary for me to adjust the editor settings (I'm sure it's fine when running deno fmt )
7 replies