I am interested in uploading JS files (self-programmed bots for a game) and executing the code inside them. At the moment, users need to have the program in a specific directory, and I retrieve the file from there like this:
this.bot = require('../bots/' + file.name);
Is there a more efficient way to accomplish this, especially one that would work when the website is running on a server (I'm unsure if my current solution would)?