Skip to content

Healthcheck

A simple way to check if an URL is reachable

healthcheck.js
import createClient from 'microlink.io'

const microlink = createClient()

const code = async ({ query, page, response }) => ({
  url: response && response.url(),
  statusCode: response && response.status(),
  headers: response && response.headers(),
  html: await page.content(),
  statusCode: response && response.status()
})

const healthcheck = (url, props) => microlink.function(url, code, props)

const { value } = await healthcheck('https://deno.com')

console.log(value)