aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/routes/getPeers/index.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/api/routes/getPeers/index.js b/api/routes/getPeers/index.js
index 22da56e..b18a015 100644
--- a/api/routes/getPeers/index.js
+++ b/api/routes/getPeers/index.js
@@ -4,8 +4,10 @@ const fs = require('fs');
module.exports = (req, res) => {
const path = config.peersFile;
if(fs.existsSync(path)){
- res.send(JSON.parse(fs.readFileSync(path)));
+ res.writeHead(200, {'Content-Type': 'application/json'});
+ res.end(JSON.stringify(JSON.parse(fs.readFileSync(path))));
} else {
- res.send({"error":"404"})
+ res.writeHead(404, {'Content-Type': 'application/json'});
+ res.end({"error":"No peers :("})
}
};