Healthcheck

A simple way to check if an URL is reachable

healthcheck.js
const microlink = require('@microlink/function')
const mql = require('@microlink/mql')

const healthcheck = microlink(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 result = await healthcheck('https://deno.com')

mql.render(result)