Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to serve a specific static file (not CSS, JS or images) in Phoenix? #155

Open
nelsonic opened this issue Aug 3, 2023 · 1 comment
Open

Comments

@nelsonic
Copy link
Member

nelsonic commented Aug 3, 2023

I would like a easy/simple way to serve a static file in a Phoenix App
e.g: when you need to verify a domain the registrar requires a .txt file.
This can sometimes be done at the DNS level. But other times it needs to be served by the Application.

My particular use case is the following: I want to serve a copy of the mix.lock file from the project
so that I can easily see exactly which version of a dependency is running.

In the past we have served an endpoint that displayed the Git version of the App
that we could then lookup on GitHub to determine exactly which version of the App was running for debugging purposes.

e.g: router.ex#L104-L106 and controllers/github_version_controller.ex

Problem is: I don't think the Git history is available on Fly.io (it wasn't on Heroku ...)
So I think the easiest thing is to serve a static file. 📁

Very grateful for any insight other people using Phoenix have on this. 💭 💬 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant