i develop web system in PHP and now i'm very excited with NODEJS.
Even though it is not a good practice, in my view, many times do that:
If the user is not logged in, them redirect.
<?php
session_start();
if(!isset($_SESSION['login']) || 4 !== (integer)$_SESSION['id_perfil_sistema']){
header("Location: /vault/");
}
?>
And other times I get the session data to customize the page according to the logged User
<li style="background-color:#ddd;">
<a style="color:blue;" href="#">
<?php echo ucwords($_SESSION['nomeusuario']); ?>
</a>
</li>
<input type="hidden" name="theOrigin" value="<?=$_SESSION['origin'];?>" />
<script type="text/javascript">
var x = <?php echo $_SESSION['session_variable']; ?>;
</script>
I have learned to create session in nodejs. =)
What best way to get session nodejs in javascript ?
I'm using nodejs and express.
kind regards