I am trying to connect a pug file to a javascript file using script. However I do not see anything viewed in the console in-spite of the console.log that I have placed there.
The following is the structure of my app.js file.
const app = express();
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "pug");
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));
I have placed the pug file under the views directory and js file in the public/js folder.
I am able to render and view the pug file on load but it does not seem to be connected to the js file.
The following is the script tag I have added on my pug file.
.script(type='text/javascript', src='js/game-client.js')
This is the folder structure of my app with public and views being in the root directory
public/js/game-client.js
views/gameroom.pug
Please help me on how to proceed this. Any help is appreciated. Thank you!