+ 2
Which language for backend is better: Node.js or PHP
I'm a frontend developer and I want to be fullstack so I don't know which language is better for me (node or php)
7 ответов
+ 14
I don't know PHP, but I can discuss how nodejs rocks. I feel comfortable with Nodejs, these are the things where it shines.
- Using JS on both client side and server side. Easier learning, since mostly people already know JS.
- Node borrows the event-loop concept from Nginx and hence able to serve multiple requests through a single threaded application.
- there is a HUGE ecosystem built around Node for supporting client side development. ( Angular, React, Vue, etc) on npm.
Actually according to Ryan Dahl (creator of Node), currently this is the intended use for Node given the weakness of JS language ( can use Typescript to overcome this) and Nodejs is not good in handling concurrent requests . For hardcore server side development he is using Golang right now.
- Nodejs = V8 + supporting libraries
And V8( JS runtime) was made by Google, therefore JS in Nodejs runs fast.
- pair nodejs with electron framework and now you can make cross platform desktop appS.
- Nodejs REPL
+ 9
I strongly recommend NodeJS based on preference over PHP, commercial demand for this experience, your existing knowledge of JavaScript on the frontend, and the trends over the past few years for NodeJS over PHP.
Other reasons include the versatility of NodeJS for other application types like command line utilities, services, and development workflow automation.
NodeJS is a self contained platform that can handle web requests without a separate web server like Apache, nginx, IIS, etc. PHP, on the otherhand, requires a separate web server to be learned, configured and managed.
While there is a PHP-CLI, it's not worth comparing to the NodeJS CLI.
On the other hand, if you plan on working on any of the open-source platforms written in PHP, like WordPress, SugarCRM, Magento, Joomla, Moodle, Drupal, etc, etc... you'll need to lean PHP.
However, I speculate that if any of these projects had the chance to start over, they would have a strong look at NodeJS with a high probability of abandoning PHP.
+ 6
amar agrawal Interesting recommendation...
Why would you recommend PHP over NodeJS based on being familiar with C/C++?
+ 4
Both can create wonder.. Just pick one you find it interested and stick with it until you have proficient enough to to build any backend services.
+ 2
NodeJS has the largest ecosystem of open source Libraries out there - the NPM - making it a completely full-fledged backend environment. This fact is enough to provide the programmer a lot of possibilities to build in the backend. Furthermore, node.js make usage of asynchronous programming which facilitate the process of handling the file request and it is memory efficient.
I do not have a in-depth know-how in PHP. But I have great time coding with Node.js and you can give a try. Even more if you started off with frontend. Javascript syntax is amplified!
+ 2
If you're a front end developer than it would be easier to learn Nodejs. The language (Js) itself remains the same, only some environment specific api addition/deletion and you are good to go. Also the demand for full stack Js is growing rapidly.
0
Both are used for back end. Although many people would suggest nodejs. It all comes come to you. If you are familiar with c,c++ go for php or go for nodejs if you are familiar with JavaScript