i had to stop becuz online lesson

This commit is contained in:
valentijn
2024-01-17 15:17:06 +01:00
parent 39fea6e13b
commit 9c0e165b33
5 changed files with 53 additions and 26 deletions

View File

@@ -2,7 +2,9 @@ const express = require('express')
const app = express()
const port = 3000
app.use(express.static("public"))
const commands = require("./commands/commands")
app.use(express.static("httpdocs/public"))
const documentRoot = `${__dirname}/httpdocs`
@@ -15,10 +17,12 @@ app.get("/execute", (req, res)=> {
const raw_command = req.query.command;
const formatted_command = String(raw_command).trim();
const currentDir = req.query.currentDir
console.log(`Executed Command: ${formatted_command}`);
if (formatted_command.startsWith("ls")){
LS(req, res);
if (formatted_command.startsWith("cd")){
commands.cd(req, res);
}
else {
res.json({"response": "invalid command"})
@@ -27,11 +31,4 @@ app.get("/execute", (req, res)=> {
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
function LS (req, res) {
res.json({"response": "LS IS WEL FICKING EPISCH"});
}
})