No Subfolder in the URL
This commit is contained in:
@@ -14,18 +14,16 @@ const __dirname = dirname(__filename);
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3001;
|
||||
const subfolder = '/ag-beats';
|
||||
const distPath = path.join(__dirname, '../dist');
|
||||
|
||||
const COLORS = ['#F94144', '#F3722C', '#F8961E', '#F9C74F', '#90BE6D', '#43AA8B', '#4D908E', '#577590', '#277DA1'];
|
||||
const getRandomColor = () => COLORS[Math.floor(Math.random() * COLORS.length)];
|
||||
|
||||
app.use(subfolder, express.static(distPath));
|
||||
app.get(subfolder + '/*', (req, res) => res.sendFile(path.join(distPath, 'index.html')));
|
||||
app.get('/', (req, res) => res.redirect(subfolder));
|
||||
app.use(express.static(distPath));
|
||||
app.get('*', (req, res) => res.sendFile(path.join(distPath, 'index.html')));
|
||||
|
||||
const httpServer = http.createServer(app);
|
||||
const wss = new WebSocketServer({ path: '/ag-beats', server: httpServer });
|
||||
const wss = new WebSocketServer({ path: '/', server: httpServer });
|
||||
|
||||
interface ClientInfo {
|
||||
ws: WebSocket;
|
||||
|
||||
Reference in New Issue
Block a user