Add route, controller, and DB methods for adding demo monitors

This commit is contained in:
Alex Holliday committed 2024-09-11 11:03:39 +08:00
1 parent 0a08b44750
commit a89777333a
10 files changed
+1402 -1302

No files matched your search

+12
View File
@@ -16,6 +16,18 @@ const ParseBoolean = (value) => {
}
};
const getTokenFromHeaders = (headers) => {
const authorizationHeader = headers.authorization;
if (!authorizationHeader) throw new Error("No auth headers");
const parts = authorizationHeader.split(" ");
if (parts.length !== 2 || parts[0] !== "Bearer")
throw new Error("Invalid auth headers");
return parts[1];
};
module.exports = {
ParseBoolean,
getTokenFromHeaders,
};