wm-AllKids-tibi2023/api/hooks/config.js

34 lines
1003 B
JavaScript
Raw Normal View History

2023-12-15 13:35:45 +01:00
const apiSsrBaseURL = "http://localhost:8080/api/v1/_/allkids_erfurt"
2023-09-17 13:24:39 +02:00
module.exports = {
2023-12-15 13:35:45 +01:00
apiSsrBaseURL,
2023-09-17 13:24:39 +02:00
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
2023-12-15 13:35:45 +01:00
// // / is de home
// if (path == "/") return 1
2023-09-17 13:24:39 +02:00
2023-12-15 13:35:45 +01:00
// // all other sites are in db
//path = path?.replace(/^\//, "")
console.log("PATH:", path)
2023-09-17 13:24:39 +02:00
// filter for path or alternativePaths
const resp = context.db.find("content", {
filter: {
2023-12-15 13:35:45 +01:00
$and: [{ path }],
2023-09-17 13:24:39 +02:00
},
2023-12-15 13:35:45 +01:00
2023-09-17 13:24:39 +02:00
selector: { _id: 1 },
})
2023-12-15 13:35:45 +01:00
console.log("RESP:", resp?.length)
2023-09-17 13:24:39 +02:00
if (resp && resp.length) {
return 1
}
// not found
return -1
},
2023-12-15 13:35:45 +01:00
ssrPublishCheckCollections: ["content"],
2023-12-26 13:45:24 +01:00
LIGHTHOUSE_TOKEN: "AIzaSyC0UxHp3-MpJiDL3ws7pEV6lj57bfIc7GQ",
2023-09-17 13:24:39 +02:00
}