Cloud function and opensea metadata uri

Hello,

I’m trying to return useful metadata for platforms such opensea to get the name and image of the nft but I’m not able to do so using cloud functions

this is the uri I have made
https://o0qbhgkqb6sq.grandmoralis.com:2053/server/functions/getNft?_ApplicationId=8W63urCyqCN4UixAizFrP8VSrN3270MVKS1ki47K&id=4

you can change number 4 at the end with another token ID
but the problem is the object that’s returned is not clean.

how can I return it as

{
name: “name”,
description: “desc”,
image: “img”
}

I guess that way opensea will be able to read my metadata and display it correctly.

I hope someone can help me

btw this is the cloud function I made

Moralis.Cloud.define("getNft", async function handle_request(req) {
  const query = new Moralis.Query("nft");
  query.equalTo("nft_id", parseInt(req.params.id));
  
  const results = await query.first();
  logger.info(results);
  
  return results;
});

Hi @ndstart

It’s not possible

You can use moralis static hosting. You can see the example on tutorial https://www.youtube.com/watch?v=tBMk1iZa85Y&t=1315s