tjpc3 The Redstoner tjpc3 The Redstoner - 1 month ago 17
Node.js Question

Should I use Node.js to do everything? Or just use it for realtime chat and use Apache/PHP for everything else?

I want to add a system where users can register accounts on my chat site that uses node.js and socket.io, but should I use node.js for everything? Or use node.js only for chatting and use Apache/PHP for registration and logging in? After I finished the Socket.io chat tutorial, I realized that Node.js can be used for serving webpages. Since Node.js has both server and client compatibility and can communicate with a MySQL server, I started to wonder why websites don't use Node.js for everything. I did some research and found this which continues to make me wonder. I found this question that helped me understand how a Node.js/apache/php website would work. (Except for the authentication stuff) So what should I do? Should I use node.js for everything including serving up the webpage, dealing with user authentication and registering, and of course the chat application. Or should I leave the registration, authentication. and actual webpage serving to Apache and PHP, then leave the chat to node.js and socket.io?

Answer

Why not using node.js for everything ?

All you need for Authentification : "passport.js" + "Csurf middlware" + "mongoose for mongodb", you can find plenty tutorials for that ^^

Comments