I want to be able to send many files, and if possible the a whole directory so that I can access it in my other js file that is getting called from an html file.
const app = require("express")();
const http = require("http").Server(app);
const io = require("socket.io")(http);
const port = process.env.PORT || 3000;
app.use("/styles", express.static(__dirname));
app.get("/", function (req, res) {
//res.sendFile("C:/Users/Kevin_Who/Desktop/Online Chat Game/index.html");
//res.sendFile("C:/Users/Kevin_Who/Desktop/Online Chat Game/mainScript.js");
res.sendFile("C:/Users/Kevin_Who/Desktop/Online Game Files/");
//app.use(express.static("Online Game Files"));
});
I tried sending many files with res.sendFile, but it only sends the first one. In the html file it references mainScript.js inside a script tag (<script src="mainScript.js" type="module"></script>). Inside the mainScript.js it also references image files, and I need help finding how to send and access these files(tiles[2].src = "./Assets/Blocks/StoneBrickWall.png";).