I have a simple text file which contains simple email strings such as:
[email protected]
[email protected]
[email protected]
[email protected]
I want to be able to return the contents of this file as a json response through my REST api which is a simple GET request.
Is there a way I can read the file line by line (I can do that) and append to a JSON object such that I can easily render the contents on a webpage.
{
"emails": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
}
I want my REST API to look like:
(GET "/emails" [] {
"emails": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
})
but I want to render the JSON upon request as the file can be modified.