How to use the prerender.sendPrerenderHeader function in prerender

To help you get started, we’ve selected a few prerender examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HW-Core / universal-pwa / apps / server / server.js View on Github external
prerenderNode.crawlerUserAgents.push('googlebot');
        prerenderNode.crawlerUserAgents.push('bingbot');
        prerenderNode.crawlerUserAgents.push('yandex');

        var prerender = require("prerender"); // commonJS syntax

        var server = prerender({
            port: config.prerender.port
        });

        process.env.CACHE_MAXSIZE = config.prerender.cache_maxpages;
        process.env.CACHE_TTL = config.prerender.cache_ttl;

        server.use(require('prerender-memory-cache'));
        server.use(prerender.sendPrerenderHeader());
        // server.use(prerender.blockResources());
        server.use(prerender.removeScriptTags());
        server.use(prerender.httpHeaders());

        const prerenderServiceUrl = config.prerender.host + ":" + config.prerender.port;
        console.log("prerenderServiceUrl: " + prerenderServiceUrl);

        app.use(prerenderNode.set('prerenderServiceUrl', prerenderServiceUrl));

        server.start();
    }

    app.use(compression());

    app.use(await smExpress(config.basePath, sitemap));
github tooleks / photo-blog / prerender / server.js View on Github external
"use strict";

const prerender = require("prerender");

const server = prerender({
    chromeFlags: ["--no-sandbox", "--headless", "--disable-gpu", "--remote-debugging-port=9222", "--hide-scrollbars"],
});

server.use(prerender.sendPrerenderHeader());
server.use(prerender.removeScriptTags());
server.use(prerender.httpHeaders());

server.start();

prerender

Service to prerender Javascript rendered pages for SEO

MIT
Latest version published 2 months ago

Package Health Score

84 / 100
Full package analysis