I am totally lost of what Node.js is all about so here’s my question:
Is node.js a new language which can replace PHP or it is a language which can/only compliment/supplement PHP and other web languages to perform complex task?
Here’s example of the full stack for web development:
- Backbone for client side, code that runs in the browser (chrome,firefox)
- Express server side framework running on Node.js
- Mongodb database for storing documents
First you have to understand the difference between server-side and client-side code.
Server-side code runs on the server, and it can do stuff like reading a database, getting file contents from the server, send mails etc. Examples of server-side code are PHP, Node.js, ASP.
PHP and Node.js are both server-side programming languages (altough node is a framework, but lets not make this any more complicated). They can both do things like database processing, reading files. As far as I know, you can’t use both PHP and Node.js at the same time, so they can’t even work together (there is probably some way to achieve this)
So to wrap it up:
Node.js and PHP are both server-side and they can do the same thing. Node.js can replace PHP and vice versa