Skip to content

Commit

Permalink
chore(crawling): temporary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Jan 1, 2019
1 parent cc5283e commit 742a089
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/overmind-website/backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,19 @@ const searchData = getSearchData()
const googleCrawlMiddleware = async function ssr(req, res, next) {
const url = req.protocol + '://' + req.hostname + req.path

console.log(req.get('user-agent'))
console.log(req.get('User-Agent'))
console.log(
req.get('User-Agent'),
path.extname(url),
path.extname(url).length
)
if (
req
.get('User-Agent')
.toLowerCase()
.indexOf('googlebot') >= 0 &&
!path.extname(url)
) {
console.log('grabbing from service')
res.send(
await new Promise((resolve) => {
https.get(
Expand All @@ -130,6 +134,7 @@ const googleCrawlMiddleware = async function ssr(req, res, next) {
})
)
} else {
console.log('next')
next()
}
}
Expand Down

0 comments on commit 742a089

Please sign in to comment.