- Learn more - what is Prerendering and why you need it
- For more detailed info, examples and API see
spiderable-middleware
package repository
This integration will work with any Node.js solution which follows Node's middleware convention, like: express, connect, vanilla Node.js server, and others
npm install spiderable-middleware --save
To cause the special behavior of web crawlers on JavaScript powered websites use fragment
meta tag. Although it's officially deprecated by Google search engine, it's may be used by other search engines and web crawlers. Learn more
<html>
<head>
<meta name="fragment" content="!">
<!-- ... -->
</head>
<body>
<!-- ... -->
</body>
</html>
See more detailed examples examples here
'use strict';
import http from 'http';
import Spiderable from 'spiderable-middleware';
const spiderable = new Spiderable({
rootURL: 'http://example.com',
auth: 'APIUser:APIPass',
});
const requestListener = function (req, res) {
spiderable.handler(req, res, function () {
res.writeHead(200, {'Content-Type': 'text/plain; charset=UTF-8'});
res.end('Hello vanilla NodeJS!');
});
};
http.createServer(requestListener).listen(3000);