feat: server

This commit is contained in:
grimhilt
2024-03-21 09:59:10 +01:00
commit fbd4f4b1f1
11 changed files with 1014 additions and 0 deletions

36
abl/lock-abl.js Normal file
View File

@@ -0,0 +1,36 @@
import { statusCodes } from '../utils/statusCodes.js';
const LOCK_PIN = 8;
let locked = true;
function is_locked() {
return locked;
}
function lock() {
locked = true;
}
function unlock() {
locked = false;
}
export async function lockAbl(req, res) {
if (is_locked()) {
return res.status(statusCodes.OK).send("Already locked");
}
lock();
return res.status(statusCodes.OK).send("Locked");
}
export async function unlockAbl(req, res) {
if (!is_locked()) {
return res.status(statusCodes.OK).send("Already unlocked");
}
unlock();
return res.status(statusCodes.OK).send("Unlocked");
}