Best way to handle new static assets
Sorry for my first contribution being a question. But I'm building a website in deno 2 + fresh and noticed the fresh service needs to restart when static files change. I was hoping to add thumbnails to a directory under /static.
What's the recommended approach for storing data from forms like images and serving them.
2 Replies
You can just change the script in your
deno.json
, the start script to be exact
Right now it's like that, but you can just remove that static/
folder from there
but then I think you'll need to manually reload? I think fresh generates a tree with the resources, so you'll probably need to reload the server after manipulating all the static files
I've never thought much about it, though, it reloads very fast, so it shouldn't be a problem, but I've also never used a big project with fresh, so yea
Yea, just tested it, you'll need to manually reload the server, that's why they're also watching the static folder. And it's probably for optimization (if it's not for optimization, it's weird), but I just tried creating a lot of files and it still reloaded kinda fast (not as fast, but still fast enough)Thank you Sun for verifying. I suppose the long term fix would be handling the image serving myself with a handler. But honestly for a small hobby thing using - -watch might be acceptable for a while.