Skip to content

Tag: node.js

Output is coming out to be Greater than sign(>)

This is the question: I’ve written my code solution in JavaScript and as it’s on CODECHEF, I gotta run it on NodeJs environment. But on submission, it shows the time limit exceeded, and on custom input, it outputs the Greater than sign(>).I strongly believe that the problem is with my input, I …

node.js multiple __dirnames

Can I put more than one file/directory down with __dirname ? example: const dirPath = path.join(__dirname, ‘/candles’); const dirPath = path.join(__dirname, ‘/lightbulbs’); const dirPath = path.join(__dirname, ‘/flashlights’); versus some sort of const dirPath = path.join(__dirname, {‘/pictures’, ‘/lightbulbs…

How does fallthrough work with express.static()?

So, I’ve a basic express setup as shown below: In the code above app.use() middleware will be executed for every request because the default path for app.use() is /. Now express.static() will be serving the public directory, so if I go to / route I will see the contents of the index.html file and the ap…

axios random url picking

I just wonder how to pick random URLs to performed an axios post request. I have three servers I want to pick randomly from currently is using only one: I just want to choose random port from Answer Example of a solution via an array