change index page when user logged in node code example
Example 1: how to set state for logged in users
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
bcrypt = require('bcrypt'),
SALT_WORK_FACTOR = 10;
var UserSchema = new Schema({
username: { type: String, required: true, index: { unique: true } },
password: { type: String, required: true }
});
module.exports = mongoose.model('User', UserSchema);
Example 2: how to redirect to another page in javascript on submit type
<script type="text/javascript" language="javascript">
function redirect()
{
window.location.href="login.php";
}
</script>
<form name="form1" id="form1" method="post">
<input type="submit" class="button4" name="order"
id="order" value="Place Order" onclick="redirect();" >
</form>