Retries in node js got do not work

182
December 25, 2017, at 5:26 PM

I am running http server which always returns 504:

const express = require('express')
const app = express()
app.get('/', (req, res) => {
    console.log('I AM HERE');
    res.status(504).send('Not found!!');
})
app.listen(3000, () => console.log('Listening on port 3000!'))

After that, I'm doing request, using got with 5 retries:

const got = require('got');
(async () => {
    try {
        const response = await got('http://localhost:3000/', {retries: 5});
        console.log(response.body);
    } catch (error) {
        console.log(error.response.body);
    }
})();

I'm expecting, that inscription I AM HERE would be logged 5 times, but it logged only once. What is wrong with my code?

READ ALSO
SETX/? And XCOPY error in Visual Studio Code

SETX/? And XCOPY error in Visual Studio Code

When I try installing npm install vue-stepper --save in the terminal when using Visual Studio Code it comes up with

281
Socket.io client not connecting

Socket.io client not connecting

I have a Socketio server running on port 3000 and when running it (and the website / client) locally everything works fine

270
Multiton design pattern in ES6

Multiton design pattern in ES6

I want to create Multiton Design Pattern as part of my user module in my nodejs application

233
Google Maps Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

Google Maps Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

I am trying to create a heatmap using JS and Google Maps API but I am getting this error

322