Page is not getting connected even after running INDEX.js correctly



This is the code…
const express = require(‘express’);
const fetch = require(“node-fetch”);

const app = express();
// Replace with your Public API Key.
const apiKey = “”;
const port = 3000;

const handleError = err => {
// The requested Builder content could not be found.
if (err.response.status === 404) {
return { data: null };
}
throw err;
};

// Catchall route
app.get(‘*’, async (req, res) => {
const encodedUrl = encodeURIComponent(req.url);
const { data: pageData } =
await fetch(https://cdn.builder.io/api/v1/html/page?apiKey=${apiKey}&url=${encodedUrl})
.then((res) => res.json())
.catch(handleError);
if (pageData) {
const pageHtml = pageData.html;

    res.send(`
  <html>
    <head> <!-- Your head content here --> </head>
    <body>
       ${pageHtml}
    </body>
  </html>
`);
} else {
    console.log("Page Data",pageData)
    res.status(404);
    res.send(/* Your 404 page HTML */);
}

});

app.listen(port, () => {
console.log(Example app listening on port ${port});
});
Please let me know any leads…

Hey @ashishpasarpolis from your code I can see you have not added your public API key.
const express = require(‘express’);
const fetch = require(“node-fetch”);

const app = express();
// Replace with your Public API Key.

const apiKey = “”;

const port = 3000;

See how you can find your API key.

If this doesn’t work please share with us your Builder Content Entry link and the Tech stack you are using.

I have deliberately kept the apiKey empty,
I have used that in actual code …
This is the Link - Builder.io: Visual Development Platform
And the tech stack i am using in - REST API
Thanks …

It looks like an integration issue. I was able to use your space without any issues. Could you try our github repo to test the integration?
You can follow our docs for API here.