This repository has been archived on 2025-03-13. You can view files and clone it, but cannot push or open issues or pull requests.
sproof_challenge_public/backend/server.js
2024-08-19 22:23:14 +02:00

23 lines
588 B
JavaScript

// I prefer backend over frontend...
import express from 'express';
const APP = express();
const PORT = process.env.PORT || 85;
APP.use(express.json()); // ability to parse json
APP.post('/api/v1/sign', async (req, res) => {
const {password, fullName} = req.body;
console.log('POST request body:', password);
if (password === "1337" && fullName) {
res.status(200).send(JSON.stringify("Success"));
} else {
res.status(401).send(JSON.stringify("Not authorized"));
}
});
APP.listen(PORT, () => {
console.log('Server is running on port 85');
});