I need to add the cors NPM package to give permissions to my expose HTTP function

Question:
I need to expose my database because I need to do something that won’t be possible on Wix, but the issue is when I try to access it, it has a Cors error:

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Product:
Wix Editor

What are you trying to achieve:
I want to expose the CMS database, to access it via an external website that I will build. When I do a fetch or json Get function, it is rejected. I know that the database is already public because the link works if I just access it through a browser or even Postman. I am not an expert programming and I am a bit lost

What have you already tried:
I have installed the cors npm package, but I am at a loss on how to utilize it. I am attaching the code I have, but I know that I am not using the cors package correctly, but I don’t know how to use it:

import { ok, notFound, serverError } from 'wix-http-functions';
import wixData from 'wix-data';


var express = require('express')
var cors = require('cors')


get_villas.use(cors({
  origin: '.....'
}))


export function get_villas({query}) {
  
  let villaNumber;
  if (query) {
    villaNumber = query.request
  }
  
  let options = {
    "headers": {
      "Content-Type": "application/json"
    }
  };
  
  let villaQuery = wixData.query("Sleep");
  if (villaNumber) {
    villaQuery = villaQuery.contains("title","300")
  }

  return villaQuery
    .find()
    .then(results => {
      if (results.items.length > 0) {
        options.body ={
          "items": results.items
        }
        return ok(options);
      }

      options.body = {
        "error": `No villa with ${villaNumber} code were found`
      }
      return notFound(options);
    })
  	.catch((error) => {
      options.body = {
        "error": error
      };
      return serverError(options);
    })
}

Additional information:
Could you help me or point me in the right direction on how to use this NPM package please? I don’t know how to give permission to a different source to access the http-function

The CORS error would be on the client side rather than the server side so it can’t be fixed within the http function itself.

Rather your GET request (or any request) needs to specify its CORS mode. For example this is how it would be done with fetch: fetch() global function - Web APIs | MDN