23 lines
635 B
JavaScript
23 lines
635 B
JavaScript
const express = require('express');
|
|
const app = express();
|
|
const PORT = 6000;
|
|
|
|
// Set your desired password here
|
|
const SERVER_PASSWORD = "hi";
|
|
let accessGranted = "yes";
|
|
|
|
app.get('/status', (req, res) => {
|
|
// Look for 'x-password' in the request headers
|
|
const clientPassword = req.headers['x-password'];
|
|
|
|
if (clientPassword === SERVER_PASSWORD) {
|
|
res.json({ run: accessGranted, message: "Authenticated!" });
|
|
} else {
|
|
res.status(401).json({ run: "no", message: "Invalid Password" });
|
|
}
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Server running. Password is required to launch calculator.`);
|
|
});
|