page for list of rooms

This commit is contained in:
2026-03-19 00:32:48 +00:00
parent 00d9d4023c
commit 8677176706
7 changed files with 83 additions and 11 deletions

View File

@@ -13,12 +13,16 @@ app.use(e.json());
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.send("Hello World");
res.send("Nothing Here");
});
app.get('/currentRooms', (req, res) => {
// req has no data
// res has all room at current time
let stmt = db.prepare(`SELECT * FROM TimeSlots`);
let records = stmt.all();
res.status(200).json({records: records});
console.log("currentRooms");
});
app.get('/addTimeslot', (req, res) => {
@@ -50,6 +54,7 @@ app.post('/createUser', async (req, res) => {
stmt = db.prepare(`INSERT INTO Users (Email, Pass, Username, Submissions) VALUES ('${body.email}', '${generatedHash}', '${body.name}', 0)`);
stmt.run();
res.status(200).send("account created");
console.log("sign up");
});
app.post('/login', async (req, res) => {
@@ -64,6 +69,7 @@ app.post('/login', async (req, res) => {
}
if (await bcrypt.compare(body.pass, storedHash.Pass)){
res.send(200);
console.log("login");
} else {
res.status(400).send("incorrect password");
}