Changed the file structure to make it more readable and removed the file endings in urls

This commit is contained in:
ION606
2022-10-11 08:38:45 -04:00
parent 5a34a4cbab
commit 1f717bf78e
10 changed files with 53 additions and 50 deletions
+25 -22
View File
@@ -117,11 +117,6 @@ app.post('/getSessionInfo', async (req, res) => {
});
app.get('/myGuilds.html', async (req, res) => {
return res.sendFile('myGuilds.html', { root: '.' });
});
app.post('/getServer', async (req, res) => {
const id = req.headers.servernumber;
@@ -162,8 +157,6 @@ app.get('/getChannels', async (req, res) => {
});
// app.get('/temp.html', async (req, res) => { return res.sendFile('temp.html', { root: '.' }); });
//Headers: servernumber, sessionid
app.post('/setCurrentServer', async (req, res) => {
try {
@@ -264,35 +257,45 @@ app.get('/getCal', async (req, res) => {
})
});
app.get('/dashboard.html', async (req, res) => {
return res.sendFile('dashboard.html', { root: '.' });
//#region HTML gile serving
app.get('/myGuilds', async (req, res) => {
return res.sendFile('myGuilds.html', { root: 'HTML' });
});
app.get('/premium.html', async (req, res) => {
return res.sendFile('premium.html', { root: '.' });
app.get('/dashboard', async (req, res) => {
return res.sendFile('dashboard.html', { root: 'HTML' });
});
app.get('/index.html', async (req, res) => {
return res.sendFile('index.html', { root: '.' });
app.get('/premium', async (req, res) => {
return res.sendFile('premium.html', { root: 'HTML' });
});
app.get('/calEvent.html', async (req, res) => {
return res.sendFile('calEvent.html', { root: '.' });
app.get('/index', async (req, res) => {
return res.sendFile('index.html', { root: 'HTML' });
});
app.get('/newCalEvent.html', async (req, res) => {
return res.sendFile('newCalEvent.html', { root: '.' });
app.get('/calEvent', async (req, res) => {
return res.sendFile('calEvent.html', { root: 'HTML' });
});
app.get('/calendar.html', async (req, res) => {
return res.sendFile('calendar.html', { root: '.' });
app.get('/newCalEvent', async (req, res) => {
return res.sendFile('newCalEvent.html', { root: 'HTML' });
});
app.get('/calendar', async (req, res) => {
return res.sendFile('calendar.html', { root: 'HTML' });
});
app.get('/team', async (req, res) => {
return res.sendFile("team.html", { root: '.' });
return res.sendFile("team.html", { root: 'HTML' });
})
//#endregion
app.post("/suggestion", async (req, res)=> {
if (req.headers.sessionid == 'null') {
return res.sendStatus(401);
@@ -565,12 +568,12 @@ app.get('/', async ({ query }, response) => {
}
}
return response.sendFile('index.html', { root: '.' });
return response.sendFile('index.html', { root: 'HTML' });
});
app.get("*",(req,res) => {
res.sendFile("404.html", {root: '.'});
res.sendFile("404.html", {root: 'HTML'});
})
app.listen(port, () => console.log(`App listening on port ${port}`));