Answers for "nodejs request timeout"

3

settimeout node js

setTimeout(function () {
    console.log("5 secondes"); 
}, 5000); 
console.log("now");
Posted by: Guest on April-03-2020
14

node http request

const https = require('https')
const options = {
  hostname: 'whatever.com',
  port: 443,
  path: '/todos',
  method: 'GET'
}

const req = https.request(options, res => {
  console.log(`statusCode: ${res.statusCode}`)

  res.on('data', d => {
    process.stdout.write(d)
  })
})

req.on('error', error => {
  console.error(error)
})

req.end()
Posted by: Guest on March-20-2020
1

node js response header

response.setHeader("Content-Type", "text/html");
Posted by: Guest on July-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language