What is best for the organization's REST API (MongoDB repository)? Nodejs or PHP?

In PHP I write for a long time, it's all clear, but with Nodejs I just met and he liked me.
I'm interested in substantiated facts, pitfalls, etc. when working with Nodejs compared to PHP. Also interested in the question of performance and Nodejs tools for easy development (extension for SublimeText and other tools).

PS: In Nodejs like to work with MongoDB using mongoose. Code is smaller (on Restify + Mongoose) than any PHP framework I've worked with (Yii2, Phalcon and a few others).
September 26th 19 at 06:15
4 answers
September 26th 19 at 06:17
for RestAPI simple rules. The performance eats more memory than PHP but is much faster and allows you to raise the RPS. Also good practice would be to raise several intensol applications (one per core and leave one core reserve) and proxy requests through nginx to these instances.

For Mongo + RestAPI is justified. If you take any framework type, or express anything more specific, you really shouldn't be. Unfortunately (or fortunately) Mongu n production I tried once, got upset and scored. On node.js demons usually keep to send notifications (APNS/GCM/WebSockets).
September 26th 19 at 06:19
I think that raising multiple instances fundamental point, to compete with php, as worker php-fpm utilize all cores of the server.
Another point: if a lot of business logic or intensive computation inside the processing of the request, then php worker will also be preferable, as in the case node.js will slow down the whole instance.
September 26th 19 at 06:21
I think to work with Mongo is better suited NodeJS. A RESTful API is easy to lift with Sails.js. With it your code will be even less ;) as for performance - with Node.js never had any problems, but in PHP at the time ate. Now I would have chosen Node.
For some reason when I was looking for a module for the REST API, my eyes have not got any advice to use sails.is, some of the many tips to use express.is or restify - trever.Wiega commented on September 26th 19 at 06:24
well , Express is a web server, not a framework to build REST API. Restify is also quite low-level. Great API, I think it will support quite difficult. In my opinion, the best platform to build a RESTful API at the moment - RoR. Sails.js the closest to him in ideology. But this is my personal opinion. Here's another, by the way, on habré there are article on the subject: habrahabr.ru/post/222259 - oswaldo.Strosin commented on September 26th 19 at 06:27
September 26th 19 at 06:23
NodeJS + Mongo + Mongoose, at least to write in fun!
Already started to do)))
Handy thing, Yes, especially with yo generators. There pulstec for Node.js + MongoDB + Mongoose + Angular.js. And most importantly - with him everything is done quickly) - trever.Wiega commented on September 26th 19 at 06:26
Yeah, and also a socket to stick you if you need it. You do get a fairy tale. - oswaldo.Strosin commented on September 26th 19 at 06:29
true! A very handy thing :) - trever.Wiega commented on September 26th 19 at 06:32
: and you can reference the description in this package yo? - Piper.Gulgowski commented on September 26th 19 at 06:35

Find more questions by tags APINode.jsnpmPHPRESTful API