Alright, I am trying to serve an apk file using node.js upon successful authentication of a get request. For this purpose I am using an api call of the form:
GET
Express has a function to download files
var apkFile = THE_ACTUAL_PATH_TO_THE_APK_NOT_UNDER_PUBLIC
if(!fs.existsSync(apkFile))
return res.status(404).send('Sorry no APKs here');
response.download(apkFile);
Documentation for download() is here http://expressjs.com/4x/api.html#res.download. Express works out the correct headers provided the extension of the filename you are sending is '.apk'.