Load a static file in top-level directory dynamically with environment variables
I have a file that I need to store in my top-level
.well-known
that needs to have some values changed within it based on environment variables. I tried using API routes to serve this file, but I can not have it prefixed by /api
for this to work.
Is there a way to add on a Nitro handler for this behavior? I have been looking through questions, closest thing I have seen is for dynamic values for a Content Security Policy but nothing on explicitly serving a JSON file that has dynamically changing keys.4 Replies
fair-rose•3mo ago
on the alpha version you can place ServerRoutes (formerly known as API Routes) anyhwere in the route tree
you are not restricted to the /api prefix anymore
genetic-orangeOP•3mo ago
Do you know when this feature will be off the alpha tag?
fair-rose•3mo ago
hopefully soon 😉
we got a few things to fix before that still
genetic-orange•3mo ago
I don't think this is documented yet (might be wrong) but you achieve it like this in the alpha build
