I am making a login system with mysql I am not being able to pass the route values to another I want to move from router login to router users follow the code
connection.query('SELECT * FROM users WHERE username = ?', [username], function(err, rows, fields) {
if (err) {
appData.error = 1;
appData['data'] = 'Error Occured!';
res.status(400).json(appData);
} else {
if (rows.length > 0) {
if (rows[0].password == password) {
if (rows[0].nivel== 1) {
res.redirect(307, '/Administration');
//eu quero passar o username/nivel para /Administration
res.send(username);
}else if (rows[0].nivel== 2) {
res.redirect(307, '/Users');
}
else if (rows[0].nivel== 3) {
res.redirect(307, '/usersvip');
}
else if (rows[0].nivel== 4) {
res.redirect(307, '/moderador');
}
else if (rows[0].nivel== 2) {
res.redirect(307, '/activar');
}
else {
res.redirect(307, '/banned');
}
the page where I want to receive the values
var express = require('express');
var router = express.Router();
router.post('/', function(req, res, next) {
res.render('Administration/index', { title: 'Home'});
});
module.exports = router;