const express = require('express');
const app = express();
const server = require('http').Server(app);
const io = require('socket.io').listen(server);
const path = require('path');
let lobbies = new Array();
app.use(express.static(path.join(__dirname, '/public')));
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, '/public', 'index.html'));
});
After refreshing page on http://localhost:8081/CreateGame/js/game I get my index.html file but all my .js and .css files trying to get them on http://localhost:8081/CreateGame/js/game.js when it should be http://localhost:8081/js/game I have no idea how I should set this up, thank you for any help.
The problem was witch src path in index.html... I had
<script src="js/game.js"></script>
And it should be like this
<script src="/js/game.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.