How to link my JS file from a different directory to my EJS file

I have an ejs file in the following directory:

./admin/admin.ejs

and i have plain old JS file in the following directory:

./public/client.js

and an express app in the following directory:

./app.js

that renders the ejs file with the following code:

const express = require("express");
const { Server } = require("socket.io");
const { sessionMiddleware, wrap } = require("./server/sessionStore");
const { createServer } = require("node:http");
const { join } = require("node:path");

const app = express();
const server = createServer(app);

const db = require("./databases/dbChooser");
const config = require("./server/config");
const { banCheckMiddleware } = require("./server/middleware");

const io = new Server(server, config.cors);

const WorkerPool = require("./server/workerPool");
const workers = new WorkerPool(1, "./drawingWorker");

app.use(sessionMiddleware);
app.use(banCheckMiddleware);

app.set("view engine", "ejs");
app.set("views", join(__dirname, "./admin"));

app.get("/", (req, res) => {
  if (!req.session.initialized) {
    req.session.initialized = true;
    req.session.visitCount = 1;
  } else {
    req.session.visitCount = (req.session.visitCount || 0) + 1;
  }
  res.sendFile(join(__dirname, "./public/index.html"));
});

app.use(express.static("public"));
app.use(express.static("admin"));

the ejs renders fine and everything works on surface level, but when i try using the client.js script in my EJS file i get the following error:
Refused to execute script from 'http://127.0.0.1:3000/public/client.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

My quick fix was to create a separate js file in the admin dir and copy and paste the client js code in it,and that works fine no errors. I also tried doing this:
<script type = "text/javascript" src="../public/client.js"></script>
but that doesnt work.The JS and CSS files inside the admin dir work fine but its when i try to reference another file from a different dir is when it gets angry.