Healthcheck

A simple way to check if an URL is reachable

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

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) =>
  mql(url, { function: code.toString(), meta: false, ...props }).then(
    ({ data }) => data.function
  )

const result = await healthcheck('https://deno.com')

mql.render(result)