You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
var express = require('express');
|
|
let res = require('express/lib/response');
|
|
var router = express.Router();
|
|
|
|
/* GET home page. */
|
|
router.get('/', function (req, res, next) {
|
|
res.render('index', { title: 'Startseite' });
|
|
});
|
|
|
|
router.get('/contact', function (req, res, next) {
|
|
res.render('contact', { title: 'Kontakt', alter: '' });
|
|
});
|
|
|
|
router.get('/portfolio', function (req, res, next) {
|
|
res.render('portfolio', { title: 'Portfolio' });
|
|
});
|
|
|
|
router.get('/neuePerson', function (req, res, next) {
|
|
console.log(req.query); //zeigt alles an, was an Route gesendet wurde
|
|
let lname = req.query.nachname;
|
|
let fname = req.query.vorname;
|
|
let city = req.query.wohnort;
|
|
let plz = req.query.postleitzahl;
|
|
let street = req.query.strasse;
|
|
let number = req.query.hausnummer;
|
|
let email = req.query.email;
|
|
let bday = req.query.geburtstag;
|
|
|
|
console.log(fname, lname, street, number, plz, city, bday, email); //console.log als debug-Instrument
|
|
|
|
console.log(bday);
|
|
|
|
let date_birth = new Date(bday).getTime();
|
|
let date_now = new Date(Date.now()).getTime();
|
|
|
|
let days = ((((date_now - date_birth) / 1000) / 60) / 60) / 24;
|
|
|
|
console.log(days);
|
|
|
|
if (days == 'NAN') {
|
|
days = 'ungültig';
|
|
}
|
|
|
|
let meinAlter = 'Ich bin ' + Math.round(days) + 'Tage alt!'
|
|
res.render('contact', { title: 'Kontakt', alter: meinAlter });
|
|
});
|
|
|
|
module.exports = router;
|