I have created a simple signup and login using node js and mongoDb. I can successfully do signup and login and now I want to add some more data to the user model after logging in from the secret page. How can I do that?
This is my user model and I want to add some text to user.text field after loggin in:
var mongoose = require("mongoose");
var UserSchema = mongoose.Schema({
username: String,
password: String,
text:String
});
module.exports = mongoose.model("User", UserSchema);
This is my view page (i.e., the secret page)
<h1>Hi, <%= user.username %></h1>
<form action="/birthday" method="post">
<input type="text" name="text">
<button type="submit">Update database</button>
</form>
The text should be shown here after updating.
Thanks!