Create web application without html

What’s the best way to create a phoenix application that will be accessed by the client which is not a web browser; the access will be in the form of a get request with various parameters. It doesn’t need the browser pipeline and response will be sent with text() function.

Just do not pipe through the browser pipeline in the router.ex, and render text or JSON as needed in your controllers/views. You do not need to do anything special upon app creation, Phoenix gives you all the convenience options to render HTML for web browsers, but in no way restricts you to it.

2 Likes

You don’t have to do anything special at creation, but --no-html & --no-webpack would give you a project without the distraction of some pieces which you will never use.

2 Likes

I tried that option and had to manually add the scope. It’s working fine now. My next major challenge has to do with deploying the application plus logging. Can you suggest any resource, especially on how to use stuff like prod.secret.ex etc. I’ve gone through a few books but most are silent on deployment and logging.

Any deployment resource with logging. Thanks a lot for your swift response yesterday.

I did not try it myself, but I heard good things about Gigalixir as a IaaS solution to deploy Elixir applications. I think other people in the forum can definitely share more experience with that.

Regarding secrets management, the best practice, not just in Elixir but in general, would be to avoid including any clear-text secret in your codebase under version control. My personal preferred option is to inject all of them as environment variables, so I can also easily use different values per environment (staging, production, etc.).

2 Likes