README Fehlerbehebungen
This commit is contained in:
parent
6dd6f41f8c
commit
c273d5d4d6
31
app.js
31
app.js
|
@ -410,16 +410,19 @@ app.get("/project/:id", async (req, res) => {
|
||||||
id,
|
id,
|
||||||
]);
|
]);
|
||||||
const projekt = result.rows[0];
|
const projekt = result.rows[0];
|
||||||
console.log(`${projekt.repository_link}/raw/branch/main/README.md`);
|
var htmlContent = projekt.beschreibung;
|
||||||
const url = `${projekt.repository_link}/raw/branch/main/README.md`;
|
try {
|
||||||
|
const url = `${projekt.repository_link}/raw/branch/main/README.md`;
|
||||||
// Abrufen der Datei
|
// Abrufen der Datei
|
||||||
const response = await axios.get(url);
|
const response = await axios.get(url);
|
||||||
// Markdown-Inhalt in HTML umwandeln
|
// Markdown-Inhalt in HTML umwandeln
|
||||||
const htmlContent = marked(response.data);
|
htmlContent = marked(response.data);
|
||||||
//const htmlContent = "Testdata";
|
//const htmlContent = "Testdata";
|
||||||
if (!projekt) {
|
if (!projekt) {
|
||||||
return res.status(404).send("Projekt nicht gefunden");
|
return res.status(404).send("Projekt nicht gefunden");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render("project", {
|
res.render("project", {
|
||||||
|
@ -429,17 +432,17 @@ app.get("/project/:id", async (req, res) => {
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.send(err);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/projectedit", async (req, res) => {
|
app.post("/projectedit", async (req, res) => {
|
||||||
req.session.message = ["", "", "none"];
|
req.session.message = ["", "", "none"];
|
||||||
const { id, name, beschreibung, repository_link } = req.body;
|
const { id, name, kurzbeschreibung, beschreibung, repository_link } =
|
||||||
|
req.body;
|
||||||
try {
|
try {
|
||||||
await pool.query(
|
await pool.query(
|
||||||
"UPDATE projects SET name = $1, beschreibung = $2 repository_link =$3 WHERE id = $4",
|
"UPDATE projects SET name = $1, kurzbeschreibung = $2, beschreibung = $3, repository_link =$4 WHERE id = $5",
|
||||||
[name, beschreibung, repository_link, id]
|
[name, kurzbeschreibung, beschreibung, repository_link, id]
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
Loading…
Reference in New Issue