• 6
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Node.js, PHP, Javascript Confusion [duplicate]

Node.js is server side Javascript environment based on chrome V8 javascript engine. It enables you to write your server code in javascript, instead of choosing one of the "traditional" web languages such as PHP, c#, python, ruby, perl etc. Using node.js and database such as mongodb you could write your web application completely in javascript.

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

Above mentioned technologies will enable you create your application writing only javascript code, from browser to server and finally to database, sort of one language to rule them :), no need for PHP unless you have legacy codebase .

  • 26
Reply Report

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.

Client-side code runs in the users webbrowser. It is used to make webpages interactive. This is mainly written in JavaScript.

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

  • 6
Reply Report
      • 1
    • Thank you. I am currently creating an live notification like facebook and they said that node.js is perfect for this.However, im currently using code igniter(php framework) and I'd assume that node.js is like javascript which you can integrate directly into the site. Thank you so much for answering.

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions