const express = require('express');
const router = express.Router();
router.get('/', function (req, res) {
	if (req.session.data == undefined) {
		req.session.data = [];
	}
	let opt = {
		title: 'Hello!',
		data: req.session.data
	}
	res.render('index', opt);
});
router.post('/', function (req, res) {
	req.session.data.unshift(req.body.msg);
	res.redirect('/');
});
module.exports = router;