Skip to main content

Hi,

I’m having trouble establishing a connection between client side and server side,

Can someone show me an example of a request made from the client to the server?

What is the order of operations? I try to fetch but I get back HTML instead of JSON.

And another question, why cant i use console.log on the client side?, its dont show nothing in the terminal


Client side:


const fetchData = async () => {

monday.execute(“notice”, {

message: “YYYYYYessssssssssssssss”,

type: “info”, // or “error” (red), or “info” (blue)

timeout: 10000,

});

try {

const response = await fetch(

https://xxxxxxxxxx1.apps-tunnel.monday.com/itemView

);

if (!response.ok) {

throw new Error(“Failed to fetch data”);

}

const jsonData = await response.json();

setData(jsonData);

} catch (error) {

console.error(“Error fetching data:”, error);

/monday.execute(“notice”, {

message: error,

type: “error”, // or “error” (red), or “info” (blue)

timeout: 10000,

});
/

}

};


server side:

router.get(‘/itemView’, function (req, res, next) {


console.log(‘Get request’ );

res.json({message: ‘ok’});

});

Be the first to reply!

Reply