Get The HTTP Status Code Of A Web Page

HTTP and HTTPS are called via different modules

const https = require('https')

https.get('https://www.alanwsmith.com/', (res) => {
  console.log('statusCode:', res.statusCode)
  console.log('headers:', res.headers)
})
const http = require('http')

http.get('http://www.alanwsmith.com/', (res) => {
  console.log('statusCode:', res.statusCode)
  console.log('headers:', res.headers)
})