Reactive Programming With MEAN stack

Asked

Viewed 151 times

1

I’m thinking about starting to develop a social network similar to Instagram, for learning purposes, using MEAN stack. I thought of my models :

User’s:

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}
})

wanted to do something to work in more 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 don’t know if I can do something like this with the socket.io, or put a setInterval() to keep checking every 1 minute, I’m thinking about architecture still, I’m very beginner still in this world of MEAN. I accept every idea, every secret.

  • http://socket.io/

  • Okay, but how can I develop this with socket.io? yes I’ve read the documentation, but I’m thinking of several kkk gambiarras

  • Can yes, or you can just use $timeoutor $interval

  • Yes, I know I can, but what I thought is, every time a user posts, they’re going to shoot and send it to every user online, whether they’re following him or not, when every user gets it, I’m going to turn it around. If I follow, I push, if I don’t follow dial.

  • It would be nice to use an Interceptor together

  • Can you tell me more about?

  • Your system will have a third party controller that will check all the requests, then in this third party you can make your business rule, e.g.: Every request updates such thing, etc. Briefly that, here are more things: http://www.webdeveasy.com/interceptors-in-angularjs-and-useful-examples/

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.