J
J
jspie2017-09-03 12:05:20
MongoDB
jspie, 2017-09-03 12:05:20

All requests come with a 503 Service Unavailable code, what's the matter?

In local mode, the requests all work, as I connected to Mongo Atlas, all the time all requests with the code 503 Service Unavailable. There is a connection.
174a8ae2d217478999109b54ee9871d0.png
One of the requests

router.get('/list/data', function(req, res, next){
  dbLink.getListGuest(req.body.array)
    .then((data)=>{ 
      res.set('Content-Type', 'application/json')
      .status(200)
      .json(data);
    })
    .catch((err)=>{ res.status(400).send(err); })
});

Everything works on localhost. I posted a site on Heroku, created a cluster on Mongodb Atlas. I entered the connection string and everything stopped working
mongoose.Promise = global.Promise;
mongoose.connect(connectionsString).
  then(() => console.log('OK')).
  catch((err) => console.log('Error:' + err));

What can be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Ivanov, 2017-09-04
@eastywest

Related question Connecting Heroku App to Atlas MongoDB Cloud service

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question