Skip to content

Commit

Permalink
fix: show uploaded json links when port 3001 is busy
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Aug 22, 2020
1 parent eb25a69 commit 968dbd5
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/start-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ module.exports = async (jsonPath, webPath=false) => {
// express.static('./web')
});

app.listen(port, () => {
const dataJson = webPath || `http://localhost:${port}/data.json`;
// console.log(`Open for view report: http://localhost:${port}/`);
console.log(`JSON file: ${dataJson}`);
console.log(`Dev viewer: http://localhost:3000/?url=${dataJson}`);
console.log(`Online viewer: https://viasite.github.io/site-audit-seo-viewer/?url=${dataJson}`);
});
function outLinks(url) {
console.log(`JSON file: ${url}`);
console.log('');
console.log(`Dev viewer: http://localhost:3000/?url=${url}`);
console.log(`Online viewer: https://viasite.github.io/site-audit-seo-viewer/?url=${url}`);
console.log('\n');
}

if (webPath) outLinks(webPath);

if(!webPath) {
app.listen(port, () => {
outLinks(`http://localhost:${port}/data.json`);
});
}
}

0 comments on commit 968dbd5

Please sign in to comment.