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.

52 lines
1.4 KiB

  1. var express = require('express');
  2. let res = require('express/lib/response');
  3. var router = express.Router();
  4. /* GET home page. */
  5. router.get('/', function (req, res, next) {
  6. res.render('index', { title: 'Startseite' });
  7. });
  8. router.get('/contact', function (req, res, next) {
  9. res.render('contact', { title: 'Kontakt', alter: '' });
  10. });
  11. router.get('/portfolio', function (req, res, next) {
  12. res.render('portfolio', { title: 'Portfolio' });
  13. });
  14. router.get('/bloginhalt', function (req, res, next) {
  15. res.render('blogInhalt', { title: 'bloginhalt' });
  16. })
  17. router.get('/neuePerson', function (req, res, next) {
  18. console.log(req.query); //zeigt alles an, was an Route gesendet wurde
  19. let lname = req.query.nachname;
  20. let fname = req.query.vorname;
  21. let city = req.query.wohnort;
  22. let plz = req.query.postleitzahl;
  23. let street = req.query.strasse;
  24. let number = req.query.hausnummer;
  25. let email = req.query.email;
  26. let bday = req.query.geburtstag;
  27. console.log(fname, lname, street, number, plz, city, bday, email); //console.log als debug-Instrument
  28. console.log(bday);
  29. let date_birth = new Date(bday).getTime();
  30. let date_now = new Date(Date.now()).getTime();
  31. let days = ((((date_now - date_birth) / 1000) / 60) / 60) / 24;
  32. console.log(days);
  33. if (days == 'NAN') {
  34. days = 'ungültig';
  35. }
  36. let meinAlter = 'Ich bin ' + Math.round(days) + 'Tage alt!'
  37. res.render('contact', { title: 'Kontakt', alter: meinAlter });
  38. });
  39. module.exports = router;