Is the joueur
variable declared inside the scope of the route, like so:
function newplayerroute(req, res, next) {
var joueur = 0;
if (typeof numJoueur == 'undefined')
/* ... */
}
If it is, then that variable gets reset every time this route/function is called. You'll need to declare it in a higher scope:
var joueur = 0;
function newplayerroute(req, res, next) {
if (typeof numJoueur == 'undefined')
/* ... */
}