I implemented a small REST API with expressjs and once I provided it to my users (internal admin team) they asked to have an additional newline at the end of each response.
In code:
var app = require('express')();
app.get('/thing/id1', function (req, res) {
res.send('data1');
})
vs:
app.get('/thing/id2', function (req, res) {
res.send("data2\n");
})
The background is that in case they use the API via curl
$ > curl -s http://localhost:3000/thing/id1
data1$ >
They want to avoid the extra echo
to have a nice output
$ > curl -s http://localhost:3000/thing/id1 ; echo
data1
$ >
I hate the additional newline in the code and it feels wrong to send it along, but I get the usecase.
So is there any argument, best practice or standard to follow in that regard?
Cheers.