Chapter 9: XSS sample update
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.get("*", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
const { previous, lang, token } = req.query;
|
const { previous, lang, token } = req.query;
|
||||||
|
|
||||||
if (!validateParameters({ previous, token, lang }, req.query)) {
|
if (!validateParameters({ previous, token, lang }, req.query)) {
|
||||||
res.sendStatus(422);
|
res.sendStatus(422);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getServiceStatus((status) => {
|
getServiceStatus((status) => {
|
||||||
res.send(`
|
res.send(`
|
||||||
<h1>Service Status</h1>
|
<h1>Service Status</h1>
|
||||||
<div id=status>
|
<div id=status>
|
||||||
${status}
|
${status}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -41,4 +42,3 @@ validateParameters = ({ previous, token, lang }, query) => {
|
|||||||
app.listen(3000, () => {
|
app.listen(3000, () => {
|
||||||
console.log("Server listening on port 3000");
|
console.log("Server listening on port 3000");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user