0.2.1 • Published 4 years ago

@uyamazak/fastify-hc-pages-plugin v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

fastify-hc-pages-plugin

A plugin that allows you to use Headless Chrome Pages with Puppeteer from Fastify

This plugin was derived from the following repository.

https://github.com/uyamazak/hc-pdf-server

Getting started

Preparing.

Usage

import fastify from 'fastify'
import { hcPagesPlugin } from '@uyamazak/fastify-hc-pages-plugin'

const app = async () => {
  server.register(hcPagesPlugin)
  // Work together with Puppeteer's Page in callback function.
  server.get('/gettitle', async (_, reply) => {
    const result = await server.runOnPage<string>(async (page: Page) => {
      await page.setContent(contentHtml, { waitUntil: 'domcontentloaded' })
      return await page.title()
    })
    reply.send(result)
  })
}

Contributing

Pull requests, Issues, GitHub Sponsors are welcome.

Contributors ✨

Thanks!

salos1982 (Pull Request)

Author

uyamazak

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago