Why there are so many comments GET Requests were called?

Viewed 21

Comments Get requests flooding.I have been trying to build a simple Event Bus . The code works fine but when I checked the network console , I saw many comments GET Requests being made . There should be only two such requests . The Request for posting a post is working fine. Here's the code for the following Event Bus :

const express = require('express') ;
const bodyParser = require('body-parser');
const axios = require('axios');

const app = express() ;
app.use(bodyParser.json()) ;

app.post('/events',(req ,res)=>{
    const event = req.body ;
    axios.post("http://localhost:4000/events",event).catch((err)=>{
        console.log(err.message);
    });
    axios.post("http://localhost:4001/events",event).catch((err)=>{
        console.log(err.message);
    });
    axios.post("http://localhost:4002/events",event).catch((err)=>{
        console.log(err.message);
    });
    res.send({status : 'OK'});
});

app.listen(4005,()=>{
    console.log('Listening on 4005') ; 
});

0 Answers
Related