Script to read the Network tab in Google Chrome’s Developer tool

I would like to create a script (which may become a Chrome extension in the future) that reads the request log and searches for keywords in urls. The goal is to build a script that replaces the manual check of the:

  1. open Network
  2. filter for a keywork
  3. see what clicks in the request urls.

If it finds something then it creates a popup to alert me otherwise it returns an error.
I have tried several scripts but it seems that the problem is in reading the network log.
This is the last script I used, how can I improve it?

// Funzione per monitorare le richieste di rete
function monitorNetworkRequests() {
  // Intercetta le richieste di rete usando l'API PerformanceObserver
  const observer = new PerformanceObserver((list) => {
    const entries = list.getEntries();

    entries.forEach((entry) => {
      const url = entry.name.toLowerCase();

      // Controlla se l'URL contiene "adform" o "doubleclick"
      if (url.includes("adform")) {
        showPopup("Tracciamenti di adform implementati!");
      } else if (url.includes("doubleclick")) {
        showPopup("Tracciamenti di doubleclick implementati!");
      } else {
        showPopup("Tracciamenti non implementati!");
      }
    });
  });

  observer.observe({ type: "resource", buffered: true });
}

// Funzione per mostrare un popup al centro dello schermo
function showPopup(message) {
  const popup = document.createElement("div");
  popup.innerText = message;
  popup.style.position = "fixed";
  popup.style.top = "50%";
  popup.style.left = "50%";
  popup.style.transform = "translate(-50%, -50%)";
  popup.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
  popup.style.color = "white";
  popup.style.padding = "20px";
  popup.style.borderRadius = "8px";
  popup.style.fontSize = "16px";
  popup.style.zIndex = "10000";

  document.body.appendChild(popup);

  // Rimuove il popup dopo 3 secondi
  setTimeout(() => {
    popup.remove();
  }, 3000);
}

// Avvia il monitoraggio delle richieste di rete
monitorNetworkRequests();

I want to convert my array into an object how can I do this? [closed]

This is my data:

let player = [
  {
    id: 0,
    identifiers: [
      "steam:1100001441b3018",
      "license:2c02c78f43961914486bae84a61783ba6c2b430e",
      "xbl:2535449350057367",
      "live:914798768384234",
      "discord:543673106997182471",
      "fivem:2462691",
      "license2:ed49169822549dc81c8a7a77be1bf57b69de8a94",
    ],
    ping: 93,
  },
  {
    id: 2,
    identifiers: [
      "steam:1100001441b3018",
      "license:2c02c78f43961914486bae84a61783ba6c2b430e",
      "xbl:2535449350057367",
      "live:914798768384234",
      "discord:543673106997182471",
      "fivem:2462691",
      "license2:ed49169822549dc81c8a7a77be1bf57b69de8a94",
    ],
    ping: 85,
  },
  {
    id: 1,
    identifiers: [
      "steam:1100001441b3018",
      "license:2c02c78f43961914486bae84a61783ba6c2b430e",
      "xbl:2535449350057367",
      "live:914798768384234",
      "discord:543673106997182471",
      "fivem:2462691",
      "license2:ed49169822549dc81c8a7a77be1bf57b69de8a94",
    ],
    ping: 90,
  },
];

I want to convert my data like this:

let player = [
  {
    id: 0,
    identifiers: {
      "steam" : "1100001441b3018",
      "license" : "2c02c78f43961914486bae84a61783ba6c2b430e",
      "xbl" : "2535449350057367",
      "live" : "914798768384234",
      "discord" : "543673106997182471",
      "fivem" : "2462691",
      "license2" : "ed49169822549dc81c8a7a77be1bf57b69de8a94",
  },
    ping: 93,
  },

CORS error (CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is) [closed]

Hey developer i stuck in CORS error please help me to solve this
i am providing you a chatGpt conversation where error and code is written in proper color theme and indentation so
read from where chatGpt firstly respond

-> first block is what error i face (by chatgpt )
-> First code snippet is about how i handle CORS in server/index.js file

-> The second snippet is about the login controller code logic (you can consider res.json code at the end)

LoginPage.jsx code(optional)

App.jsx(optional)

https://chatgpt.com/share/672e074b-0530-800e-a5fa-d13113d036be

Hey developer i stuck in CORS error please help me to solve this
i am providing you a chatGpt conversation where error and code is written in proper color theme and indentation so
read from where chatGpt firstly respond

-> first block is what error i face (by chatgpt )
-> First code snippet is about how i handle CORS in server/index.js file

-> The second snippet is about the login controller code logic (you can consider res.json code at the end)

LoginPage.jsx code(optional)

App.jsx(optional)

https://chatgpt.com/share/672e074b-0530-800e-a5fa-d13113d036be

I can’t draw a cube correctly in NW

I’ve tried everything.
How to make an isometric cube render in the NW direction.
Considering that width is the length, height is the height, depth is the width.
I tried this, but it doesn’t work:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Render Cube4</title>
    <style>
        canvas {
            border: 1px solid black;
            display: block;
            margin: 20px auto;
        }
    </style>
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
<script>
    function render_cube4(entity, ctx) {
        ctx.strokeStyle = "#d17a26";
        ctx.fillStyle = "rgba(32, 32, 32, 0.4)";
        ctx.beginPath();
        ctx.moveTo(-entity.width / 2, entity.height / 2 - entity.z);
        ctx.lineTo(0, -entity.height / 2 - entity.z);               
        ctx.lineTo(entity.width / 2, entity.height / 2 - entity.z); 
        ctx.closePath();
        ctx.fill();
        ctx.stroke();
        ctx.fillStyle = "rgba(16, 16, 16, 0.32)";
        ctx.beginPath();
        ctx.moveTo(0, -entity.height / 2 - entity.z);                      
        ctx.lineTo(entity.width / 2, entity.height / 2 - entity.z);       
        ctx.lineTo(entity.width / 2, -entity.height / 2 - entity.z - entity.depth); 
        ctx.lineTo(0, -entity.height / 2 - entity.z - entity.depth);       
        ctx.closePath();
        ctx.fill();
        ctx.stroke();
        ctx.fillStyle = "rgba(0, 0, 0, 0.4)";
        ctx.beginPath();
        ctx.moveTo(-entity.width / 2, entity.height / 2 - entity.z); 
        ctx.lineTo(0, -entity.height / 2 - entity.z);               
        ctx.lineTo(-entity.width / 2, -entity.height / 2 - entity.z - entity.depth);
        ctx.lineTo(0, -entity.height / 2 - entity.z - entity.depth); 
        ctx.closePath();
        ctx.fill();
        ctx.stroke();
    }
   
    const canvas = document.getElementById('canvas');
    const ctx = canvas.getContext('2d');
    const entity = {
        width: 100,
        height: 100,
        depth: 10,
        z: 50
    };
    ctx.translate(canvas.width / 2, canvas.height / 2);
    render_cube4(entity, ctx);
</script>
</body>
</html>

I’m already tired and confused! Help me out, guys!
I need to get:

enter image description here

ThreeJS Add border for Text Object

Created Text with TextGeometry in Threejs,

    const font = await loadFont(fontUrl)
    const geometry = new TextGeometry("文字", {
        font: font,
        size: size,
        depth: 10,
        bevelEnabled: false,
        bevelThickness: 1,
        bevelSize: 1,
        bevelOffset: 0,
        bevelSegments: 0
    })
    const material = new THREE.MeshStandardMaterial({
        color: color
    })
   

    const mesh = new THREE.Mesh(geometry, material)

want to add a border for it, like this :

expected effect

blue in the middle is the original text, red is the border.

Try troika-three-text project.
It’s very nice, but seems no depth for text.

Telegram API premium emoji in the messages

I have a mass mailings system using the Telegram API written in javascript. This system uses a premium account and I want to use premium emoji in messages, but I can’t figure out how this works. Can anyone give me an example of code that uses premium emoji in a message? My message should contain a multiple emoji and text.

You can find the code for my mailing system below:

const { TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");
const fs = require("fs");
const path = require("path");
const input = require("input");

const apiId = 28107062;
const apiHash = "83933d5090483dd4733b1d25d3872737";
const sessionFilePath = path.join(__dirname, 'session.txt');
let stringSession = new StringSession("");

if (fs.existsSync(sessionFilePath)) {
  stringSession = new StringSession(fs.readFileSync(sessionFilePath, 'utf-8'));
} else {
  console.log("Session file not found. You will need to log in.");
}

const chatIds = [-1001966242541, -1001830585462, -1002118952351, -1002063174103, -1001389021288, -1001903976242, -1002342203094, -1002432255669, -1002423169211, -1002491856745, -1001252294905, 1002140505574, -1002367282121];
let messageCount = 0;

(async () => {
  console.log("Loading interactive example...");
  const client = new TelegramClient(stringSession, apiId, apiHash, {
    connectionRetries: 5,
  });

  if (!fs.existsSync(sessionFilePath)) {
    await client.start({
      phoneNumber: async () => await input.text("Please enter your number: "),
      password: async () => await input.text("Please enter your password: "),
      phoneCode: async () => await input.text("Please enter the code you received: "),
      onError: (err) => console.log(err),
    });

    fs.writeFileSync(sessionFilePath, client.session.save(), 'utf-8');
    console.log("Session saved.");
  } else {
    await client.connect();
    console.log("You should now be connected with the saved session.");
  }

  const filePath = path.join(__dirname, 'example.png');
  const messagePath = path.join(__dirname, 'message.txt');
  let messageText;

  try {
    messageText = fs.readFileSync(messagePath, 'utf-8');
  } catch (error) {
    console.error("Error reading message file:", error);
    return;
  }

  const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

  const sendMessages = async () => {
    for (const chatId of chatIds) {
      try {
        await client.sendFile(chatId, {
          file: filePath,
          caption: messageText,
        });

        messageCount++;
        const now = new Date();
        const formattedDate = now.toLocaleString();

        console.log(`${formattedDate} - ${messageCount} message(s) sent to chat ID: ${chatId}`);

      } catch (error) {
        if (error.code === 403 && error.errorMessage === 'CHAT_SEND_PHOTOS_FORBIDDEN') {
          console.log(`Cannot send photo to chat ID: ${chatId}, sending text instead.`);
          try {
            await client.sendMessage(chatId, { message: messageText });
            console.log(`Text message sent to chat ID: ${chatId}`);
          } catch (sendTextError) {
            console.error(`Error while sending text message to chat ID: ${chatId}`, sendTextError);
          }
        } else if (error.code === 403 && error.errorMessage === 'CHAT_WRITE_FORBIDDEN') {
          console.log(`Cannot send any message to chat ID: ${chatId}. Permission denied. Skipping...`);
        } else if (error.code === 420 && error.errorMessage.startsWith('FLOOD')) {
          const waitTime = error.seconds * 1000;
          console.log(`FLOOD_WAIT: Need to wait ${error.seconds} seconds before sending the next message.`);
          await delay(waitTime);
        } else {
          console.error(`Error while sending photo and message to chat ID: ${chatId}`, error);
        }
      }

      await delay(10000);
    }
  };

  sendMessages();

  setInterval(sendMessages, 3600000);
})();

My message should contain a multiple emoji and text.
I found information about bots not being able to use premium emoji, but I don’t think this is related to the telegram api, and I see other people using premium emoji in their mailings.

How can I call a previous tab from

I’m trying to open a link in the previous tab

there’s 3 pages

  • index.html
  • schedule.html
  • player.html

when on index.html and you press the “player” button it opens on a new tab (What I want).

When I am on the player page and I click the “schedule” button I want it to use the tab with index.html and go to schedule.html.

there is a few websites that do this but I cant figure it out.

Trying to send automatic email to new website registration

I am trying to use azure to send automatic email, I am using a combination of Azure Communication Services and Azure Function App. I am trying to get users of my website receive an automatic email when they sign up. I am using a HTTP trigger in Azure function to automate the process. When I copy the JS code from ACS to the function app I get a server error and haven’t been able to troubleshoot it yet. This is the code

const { EmailClient } = require("@azure/communication-email");

const connectionString = "endpoint=https://test-email-ktv.uk.communication.azure.com/;accesskey=DZx53W8VWIWSD312Ujt3aUeD63AdwCrJ7ZnYRNxodcUFgISfqIjOJQQJ99AKACULyCpygbUvAAAAAZCSSiCT";
const client = new EmailClient(connectionString);

async function sendEmail(name, email) {
    const emailMessage = {
        senderAddress: "f6772394-f09c-4dc0-94db-c424bc104f40.azurecomm.net", // Replace <from_domain> with your verified domain
        content: {
            subject: "Membership Confirmation",
            plainText: `Hello ${name},nnThank you for signing up!`,
            html: `
                <html>
                    <body>
                        <h1>Hello ${name},</h1>
                        <p>Thank you for signing up! We have received your details.</p>
                    </body>
                </html>`,
        },
        recipients: {
            to: [{ address: email }],
        },
    };

    try {
        const poller = await client.beginSend(emailMessage);
        const result = await poller.pollUntilDone();
        console.log("Email sent successfully:", result);
        return { success: true, message: "Email sent successfully" };
    } catch (error) {
        console.error("Error sending email:", error);
        return { success: false, message: "Failed to send email" };
    }
}

module.exports = async function (context, req) {
    const { name, email } = req.body; 

    if (!name || !email) {
        context.res = {
            status: 400,
            body: { message: "Name and Email are required." },
        };
        return;
    }

    const response = await sendEmail(name, email);

    context.res = {
        status: response.success ? 200 : 500,
        body: { message: response.message },
    };
};

This is the code on my website javascript thats intended to send the user details over to the azure function:

document.addEventListener("DOMContentLoaded", () => {
    const form = document.getElementById("membershipForm");
    if (form) {
        form.addEventListener("submit", async (event) => {
            event.preventDefault();

            const name = document.getElementById("Full Name").value;
            const gender = document.getElementById("Gender").value;
            const email = document.getElementById("Email").value;
            const phone = document.getElementById("Phone Number").value;

            try {
                const response = await fetch("https://membership-form-function.azurewebsites.net/api/signup?", {
                    method: "POST",
                    headers: {
                        "Content-Type": "application/json"
                    },
                    body: JSON.stringify({ name, gender, email, phone })
                });

                if (response.ok) {
                    document.getElementById("responseMessage").innerText = "Email sent successfully!";
                } else {
                    document.getElementById("responseMessage").innerText = "An error occurred. Please try again.";
                }
            } catch (error) {
                document.getElementById("responseMessage").innerText = "An error occurred. Please try again.";
                console.error("Error:", error);
            }
        });
    } else {
        console.error("Form element with id 'membershipForm' not found.");
    }
});

generate sequence of numbers based on a range of values

I want to create an array of 9 values as result, where i have written a function which takes the min and max value

function generateSequence(min, max, numElements = 9) {
  // Step 1: Calculate the raw step size
  let step = (max - min) / (numElements - 3); // One value below min, and one above max
  
  // Step 2: Dynamically determine the rounding factor based on the step size
  const orderOfMagnitude = Math.pow(10, Math.floor(Math.log10(step))); // Find the magnitude (e.g., 10, 100, 1000)
  
  // Step 3: Round the step to the nearest multiple of the order of magnitude
  const roundedStep = Math.round(step / orderOfMagnitude) * orderOfMagnitude;

  // Step 4: Start from a value a bit lower than the min, ensuring we have one value below min
  const startValue = Math.floor(min / roundedStep) * roundedStep - roundedStep;

  // Step 5: End at a value a bit higher than the max, ensuring we have one value above max
  const endValue = Math.ceil(max / roundedStep) * roundedStep + roundedStep;

  // Step 6: Generate the sequence with the dynamically adjusted start and end
  const sequence = Array.from({ length: numElements }, (_, i) => startValue + i * roundedStep);

  return sequence;
}

const min = 100;
const max = 200;
const result = generateSequence(min, max);
console.log(result);

i want to get only one value above the max value and one value less than the min value, if you see the result its giving me 220 & 240, ideally with 220 the array should end. but then i need 9 integers which will get reduced to 8, so i want to shift my first integer to some more lower value and based on that sequence should get generated, how to do this

Retrieve slotted elements and put them into an array

I’m having a problem with Lit components I’m really not able to find a solution for no matter how hard I tried.

Here’s how my <f-news-tags /> Lit component is used in Storybook:

const props = {
  tags: [
    {
      id: '605331e873b0c322aff5cce7',
      url: 'https://www.example.com/uno',
      label: 'Uno',
    },
    {
      id: '605331e873b0c322aff5cce8',
      url: 'https://www.example.com/due',
      label: 'due',
    },
 ......
}
<f-news-tags>
      <ul slot="list">
      ${
          props.tags.map((tag) => html`
            <f-news-tag slot="items"
              id=${tag.id}
              url=${tag.url}
              label=${tag.label}
            ></f-news-tag>
          `)
        }
      </ul>
    </f-news-tags>

It basically cycles through the tags array of objects and returns an <f-news-tag> for each object with the object data passed to it.

Here’s how I built <f-news-tags>:

@customElement('f-news-tags')
export default class NewsTags extends LitElement {
  static override styles: CSSResultGroup = [componentStyles, styles];
  static dependencies = {
    'f-container': Container
  };

  @property({ type: String }) date: string = '12.12.2022';
  @property({ type: Array, attribute: false }) tags = [];
  @property({ type: Boolean }) showMore = false;

  @queryAssignedElements({slot: 'items', flatten: true}) listItems!: Array<HTMLElement>;

  override firstUpdated() {
    console.log("This is the array of items", this.listItems);
  }

  override render() {
    return html`
      <div class="wrapper">
        <f-container size="m" topspace="m" bottomspace="m">
          ${this.date ? html`<div class="date">${this.date}</div>` : ''}
          <slot name="list">
            <slot name="items"></slot>
          </slot>
        </f-container>
      </div>
    `;
  }
}

And here’s how I built the single <f-news-tag>:

@customElement('f-news-tag')
export default class NewsTag extends LitElement {
  static override styles: CSSResultGroup = [componentStyles, styles];

  @property({ type: String }) label = "";
  //@property({ type: String }) id = "";
  @property({ type: String }) url = "";

  override render() {
    return html`
      <li class="item">
        <a class="link" href="${this.url}">${this.label}</a>
      </li>
         `;
  }
}

As you probably noticed, the is assigned to the ‘list’ slot and all <f-news-tag> items inside the are assigned to the ‘items’ slot.

In <f-news-tags>, I’m trying to use the @queryAssignedElements (I’ve also already tried @queryAssignedNodes) decorator to get an array of the elements inside the ‘items’ slot. What I’m trying to achieve with this is to be able to conditionally render a show more/show less button when the cycled items exceed a given number. Despite all my efforts, however, the resulting listItems array is always empty.

Choices.js – server-side search filtering

I want to use Choices JS as the UI for server side search filtering. The demo only includes loading the whole list and filtering client-side – I have too many records for that to be viable.

I have got it working except for one thing, which is that as you type, the search box loses focus, meaning its almost unusable from a UX point of view.

I have this so far (note it is wrapped in a Knockout binding and uses a timeout as a fake request):

(function()
{
    var _getConfig = function(el, f_valueaccessor, allbindings, viewmodel, bindingcontext)
    {
        var cfg = ko.unwrap(f_valueaccessor());

        var res = {
            obs: cfg.boundField,
            src: cfg.src,
            multiple: ko.unwrap(cfg.multiple) || false,
            options: cfg.options || {},
            _current: cfg.items || ko.observableArray()
        };

        return res;
    };

    ko.bindingHandlers.choices = {
        init:
            function(el, f_valueaccessor, allbindings, viewmodel, bindingcontext)
            {
                var cfg = _getConfig(el, f_valueaccessor, allbindings, viewmodel, bindingcontext);
                cfg.multiple && el.setAttribute('multiple');

                var chc = new Choices(el, {
                    searchChoices: false,
                    shouldSort: false,
                    shouldSortItems: false
                });
                
                chc.setChoices(function()
                {
                    return cfg.src(chc, { initial: true, term: null });
                });

                el.addEventListener('search', function(e)
                {
                    console.log('search', e);
                    chc.setChoices(function() { return cfg.src(chc, { initial: false, term: e.detail.value }) });
                });
            },
        update:
            function(el, f_valueaccessor, allbindings, viewmodel, bindingcontext)
            {
            }
    };
})();

var model = new function()
{
    this.Choice = ko.observableArray();
    this.IsMultiple = ko.observable(false);

    this.find = function(sender, eargs)
    {
        return new Promise(function(resolve)
        {
            setTimeout(function()
            {
                resolve([{ value: 1, label: 'Hello' }, { value: 2, label: 'World' }]);
            }, 100);
        });
    };
};

ko.applyBindings(model);

Working Fiddle: https://jsfiddle.net/whelkaholism/5sn9wt0r/22/

UPDATE:

I have changed the search event handler to the below and it works, but it seems pretty hacky, is there a better way?

el.addEventListener('search', function(e)
                {
                    console.log('search', e, chc);
                    
                    chc.setChoices(function() { 
                        return new Promise(function(resolve){
                        cfg.src(chc, { initial: false, term: e.detail.value }).then(function(data) {
                            resolve(data);
                          
                          setTimeout(function() {chc.choiceList.element.parentElement.querySelector('input[type=search]').focus(); }, 0);
                        });
                      });
                     });
                });

Issue configuring the AdminJs with AdonisJs

After configuring adminjs with adonisjs, on login page submission getting below error

[10:36:59.660] WARN (19996): Invalid or expired CSRF token
    request_id: "cxr22kmkdovlty98vsi5p3en"
    x-request-id: "cxr22kmkdovlty98vsi5p3en"

Solution:

add admin login route into exceptRoutes in shiled.ts under config folder. Hope this would help someone in the future, cuz adminjs is a good admin panel for js frameworks. I was about to give up. But finally fixed this way,

  csrf: {
    enabled: true,
    exceptRoutes: ['/admin', '/admin/login', '/admin/logout'],
    enableXsrfCookie: false,
    methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
  },

Cookie script runs only once

I am add link in the footer “cookie policy”,But Script execute and runs only once launch the popup, I need to launch the pop everytime when i am click on the link.

<div>className="action-label" onClick={() => onCookiePolicyHandler()}>Cookie Policy</div>


onCookiePolicyHandler() {
  const script = document.createElement('script');
  script.setAttribute(src, xxxx);
  -----Adding Mutilple attributes-----
  document.head.appendChild(script);
}

the above function executes only once launch the popup, when i click on the more than once the script is not showing any popup. Could you please help me on this.

enter image description here

A MIME type of “text/html”

I deployed my app to render and it worked fine for one day but after that I’ve got and error in console.

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.

I checked the paths and still no progress in solving it, sitting second day on it and trying to fix. I would appreciate any help

This is my vite config

export default defineConfig({
  plugins: [react()],
  base: "/",
  server: {
    proxy: {
      "/api": {
        target: "http://localhost:3003",
        changeOrigin: true,
      },
    },
  },
});

This is my app.js in node

const express = require("express");
const app = express();
const cors = require("cors");
const userController = require("./controllers/user");
const loginController = require("./controllers/login");
const taskController = require("./controllers/task");
require("dotenv").config();
const mongoose = require("mongoose");
const path = require("path");

app.use(express.json());
app.use(cors());

// MongoDB connection
const dbPassword = process.env.DB_PASSWORD;
const dbUrl = process.env.DB_URL.replace("<db_password>", dbPassword);

mongoose.set("strictQuery", false);
console.log(`Connecting to ${dbUrl}`);

mongoose
  .connect(dbUrl)
  .then(() => {
    console.log("connected to MongoDB");
  })
  .catch((error) => console.log("Error connecting to mongo DB", error.message));

app.use(express.static(path.join(__dirname, "dist")));

// Serve index.html for non-API and non-static file requests (for client-side routing)
app.get("*", (req, res) => {
  res.sendFile(path.join(__dirname, "dist", "index.html"));
});

// API Routes
app.use("/api/user", userController);
app.use("/api/login", loginController);
app.use("/api/new-task", taskController);

// Serve static files from 'dist' directly without '/api' path

// Error handling middleware
app.use((err, req, res, next) => {
  console.log(err.stack);
  if (err.name === "ValidationError") {
    const errorMessage = err.details.map((detail) => detail.message).join(", ");
    return res.status(400).json({ message: errorMessage });
  }
  if (err.statusCode) {
    return res.status(err.statusCode).json({ message: err.message });
  }
  res.status(500).json({ message: "Internal server Error" });
});

module.exports = app;

File Management System but its not taking the data from form and cant submit

I have created a File Management System that allows users to create their own accounts, upload and manage files as well as create and manage albums.

However, I want to create a limit of rows (of 10) for handling large data by adding pages to “Manage Files” and when creating an album as well in “Create Album” ‘Picking Media Files’. I keep having errors as well when it comes to being able to submit the form, the checkboxes lose their checked state when submitting. I don’t understand why

Link to Code: Github