Open xgqfrms opened 4 years ago
https://github.com/xyz-data/puppeteer?organization=xyz-data&organization=xyz-data#usage
# Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API.
$ npm i puppeteer
# or
$ yarn add puppeteer
# a version of Puppeteer that doesn't download Chromium by default.
$ npm i puppeteer-core
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
await browser.close();
})();
https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core
steps
server
Node server parse URL args(api path, type)
template page fetch data using URL args
QRCode component generator QRCode Image, insert template page
SSR render template page, then using canvas create image
Node response Image, download url / base64
client
request URL with args
render response image