Neuer Caroussel Code
This commit is contained in:
parent
0a89ea7a14
commit
d38dba711d
17
index.js
17
index.js
@ -5,6 +5,9 @@ const multer = require('multer');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
//Rate Limit
|
||||||
|
const rateLimit = require('express-rate-limit');
|
||||||
|
|
||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.PORT || 3000;
|
const port = process.env.PORT || 3000;
|
||||||
@ -149,6 +152,18 @@ app.post("/api/users", async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Rate Limiter fuer Login
|
||||||
|
const loginLimiter = rateLimit({
|
||||||
|
windowMs: 15 * 60 * 1000,
|
||||||
|
max: 9999,
|
||||||
|
standardHeaders: true,
|
||||||
|
legacyHeaders: false,
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Benutzer Login
|
// Benutzer Login
|
||||||
app.post("/api/login", async (req, res) => {
|
app.post("/api/login", async (req, res) => {
|
||||||
const { username, password } = req.body;
|
const { username, password } = req.body;
|
||||||
@ -209,7 +224,7 @@ app.get("/api/users", async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Benutzer l<EFBFBD>loeschen
|
// Benutzer loeschen
|
||||||
app.delete("/api/users/:id", async (req, res) => {
|
app.delete("/api/users/:id", async (req, res) => {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user