Sebastian Frank
1ebd1424e5
Some checks failed
deploy to production / deploy (push) Failing after 52s
32 lines
958 B
JavaScript
32 lines
958 B
JavaScript
const apiSsrBaseURL =
|
|
"http://localhost:" + context.config.server().api.port + "/api/v1/_/" + context.api().namespace + "/"
|
|
|
|
module.exports = {
|
|
apiSsrBaseURL,
|
|
ssrValidatePath: function (/** @type {string} */ 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(/^\//, "")
|
|
const resp = context.db.find("content", {
|
|
filter: {
|
|
$and: [{ path }],
|
|
},
|
|
|
|
selector: { _id: 1 },
|
|
})
|
|
if (resp && resp.length) {
|
|
return 1
|
|
}
|
|
|
|
// not found
|
|
return -1
|
|
},
|
|
ssrPublishCheckCollections: ["content"],
|
|
LIGHTHOUSE_TOKEN: "AIzaSyC0UxHp3-MpJiDL3ws7pEV6lj57bfIc7GQ",
|
|
}
|