const express = require("express");
const app = express();
const data = require("./models/bilder");
const url = require("url")

app.set("view engine", "ejs");
app.set("views", "views");

// Hier Code ergaenzen!
const router = express.Router();
app.use(express.static("public"));
router.get("/", function(req,res){
    const param = url.parse(req.url, true).query;
    var current = Number(param.num) || 0;
    var beschreibung = param.beschreibung || data.holeStartBild().beschreibung;
    var img = param.img || data.holeStartBild().dateiname;
    res.render("home",{
        current: current,
        beschreibung: beschreibung,
        img: img,
        vor: data.vor,
        zurueck: data.zurueck
    });
});
app.use(router);

app.listen(8910);