I'm thinking of starting to develop a social network similar to that of instagram, for learning purposes, using MEAN stack. I thought about my models:
User:
var mongoose = require('mongoose');
module.exports = mongoose.model('User', {
email: String,
username: String,
password: String,
image: String,
bio: String,
following: [{userId: String}],
followers: [{userId: String}]
});
var mongoose = require('mongoose');
module.exports = mongoose.model('Post', {
user: String,
userId: String,
userImage: String,
content: String,
date: {type: Date, default: Date.now}
})
I wanted to do something to work in real time so that when a user makes a post, who is following him and is logged in to receive this post in his $ scope, I do not know if I can do something like that with socket.io , or put a setInterval () to be checking every 1 minute, I'm thinking about the architecture still, I'm very new beginner in this world of MEAN. I accept all ideas, and interests.