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