react-hydratable-shj
Version:
hold-on DOM structure for improving React SEO (Original by NamGungGeon, Custom by tkguswls1106)
33 lines (27 loc) • 749 B
JavaScript
const createHttpServer = require('./src/webserver');
const startCrawler = require('./src/crawler');
const config = require('./src/config');
const args = process.argv.slice(2);
if (args.includes('--preview')) {
//preview mode
createHttpServer(config.webroot, config.port);
return;
}
//crawling mode
const closeHttpServer = createHttpServer(config.webroot, config.port, () =>
startCrawler(
config.port ? config.host + ':' + config.port : config.host,
config.crawlingUrls,
config.webroot,
config.delay,
config.userAgent,
config.htmlPrefix,
config.pageCount,
config.retryCount
)
.catch((e) => {
console.error('Crawling: [error]\n', e);
})
.finally(closeHttpServer)
);