How to Render React SSR with Deno and Deno Deploy

Plenty of articles show you how to use Strapi with various frameworks, such as GatsbyNext.js, and Nuxt.js, but these frameworks require Node.js for the backend.


This is a companion discussion topic for the original entry at https://strapi.io/blog/rendering-react-ssr-with-deno-and-deno-deploy

// Something happens when getting Json data from STRAPI_API_URL, (formatting perhaps?) piping properly formatted raw data and works.

error: Uncaught (in promise) SyntaxError: Unexpected token N in JSON at position 0

// with error catching

try {
respond data
const response = new Response(body, {
headers: { “content-type”: “text/html; charset=utf-8” },
});

console.log(‘response data?’, data)
event.respondWith(response);
} catch(error) {
console.log(‘Error happened here!’)
console.error(error)
}

SyntaxError: Unexpected token N in JSON at position 0

I was able to solve it. The problem was in getData function where I was using a wrong url.