wm-AllKids-tibi2023/api/hooks/config.js
robin 8184ffecf4
Some checks failed
deploy to production / lighthouse-evaluation (push) Failing after 1s
deploy to production / deploy (push) Failing after 28s
lighthouse
2023-12-26 12:45:24 +00:00

34 lines
1003 B
JavaScript

const apiSsrBaseURL = "http://localhost:8080/api/v1/_/allkids_erfurt"
module.exports = {
apiSsrBaseURL,
ssrValidatePath: function (path) {
// validate if path ssr rendering is ok, -1 = NOTFOUND, 0 = NO SSR, 1 = SSR
// pe. use context.readCollection("product", {filter: {path: path}}) ... to validate dynamic urls
// // / is de home
// if (path == "/") return 1
// // all other sites are in db
//path = path?.replace(/^\//, "")
console.log("PATH:", path)
// filter for path or alternativePaths
const resp = context.db.find("content", {
filter: {
$and: [{ path }],
},
selector: { _id: 1 },
})
console.log("RESP:", resp?.length)
if (resp && resp.length) {
return 1
}
// not found
return -1
},
ssrPublishCheckCollections: ["content"],
LIGHTHOUSE_TOKEN: "AIzaSyC0UxHp3-MpJiDL3ws7pEV6lj57bfIc7GQ",
}