23 lines
588 B
JavaScript
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');
|
|
});
|