Using mongoose I created a database that stores the info of a user: username, name, email..
Now, I want to display to him his profile. So, first, how do I get the username of the user currently logged in. And, second, how do I get the rest of his data from the database using node.js, and display it on the browser using handlebars?
Here's my schema for user:
var UserSchema = new mongoose.Schema({
username: {
type: String,
index:true
},
password: String,
email: String,
name: String,
hasPortfolio: Boolean
});
var User = module.exports = mongoose.model('User', UserSchema);
Everything works perfectly, from registering and logging in. Now I just want to display his profile, like:
Username: (username)
Name: (name)
E-mail: (email)
So, what should I do?
Aucun commentaire:
Enregistrer un commentaire