Skip to content

Commit

Permalink
fix(website): fix crawling
Browse files Browse the repository at this point in the history
  • Loading branch information
christianalfoni committed Jan 1, 2019
1 parent 742a089 commit bb0943f
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions packages/overmind-website/backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,13 @@ const apis = getApis()
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'),
path.extname(url),
path.extname(url).length
)
if (
req
.get('User-Agent')
.toLowerCase()
.indexOf('googlebot') >= 0 &&
!path.extname(url)
!path.extname(req.path)
) {
console.log('grabbing from service')
res.send(
await new Promise((resolve) => {
https.get(
Expand All @@ -134,7 +126,6 @@ const googleCrawlMiddleware = async function ssr(req, res, next) {
})
)
} else {
console.log('next')
next()
}
}
Expand Down

0 comments on commit bb0943f

Please sign in to comment.