"message": "Unauthorized Access" is showing when I get http://localhost:5000/my from this location

“message”: “Unauthorized Access” when i post something on my input form post is working correctly but when I wanted to get that thing http://localhost:5000/my it’s showing “message”: "Unauthorized Access

serverSide Code IS:

app.post("/order", async (req, res) => {

        const my = req.body;

        const result = await myCollection.insertOne(my);

        res.send(result);

      });

      app.get("/order", async (req, res) => {

        const query = {};

        console.log(query);

        const cursor = myCollection.find(query);

        const services = await cursor.toArray();

        res.send(services);

      });

Client side code is:

const onSubmit = (data, event) => {

    const url = `http://localhost:5000/service`;

    fetch(url, {

      method: "POST",

      headers: {

        "content-type": "application/json",

      },

      body: JSON.stringify(data),

    })

      .then((res) => res.json())

      .then((result) => {

        setIsReload(!isReload);

        if (result) {

          alert("Add Successful");

        }

      });

    const order = {

      email: user.email,

      name: event.target.name.value,

      description: event.target.description.value,

      price: event.target.price.value,

      quantity: event.target.quantity.value,

    };

    axios.post(`http://localhost:5000/order`, order).then((res) => {

      const { data } = res;

      console.log(data);

      if (data.insertedId) {

        alert("Inserted");

      }

      event.target.reset();

      console.log(res);

    });

Hi @Mahesh_Biswas
Welcome to the community forum!!

Could you please help me in understanding where do you see this error.
Is this on the browser or over the Postman application. ?

Also, as per the URL: http://localhost:5000/my , is there an API which gets called to display the user inserted.
As per the code snippet mentioned, "/order" would give the result for the GET request.

Also, for our better understanding, could you help with the complete error message with more details or error message related to MongoDB.

Thanks
Aasawari

I have already solved it, mam, thanks for you message