page for list of rooms
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user