Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Node as REST server alongside PHP [closed]

I've got a functional site running right now in PHP on apache; PHP and apache are serving the needs of serving the site content quite nicely. I'm looking to convert my existing PHP API server code to a RESTful interface; most of the design issues are worked out on that front. PHP doesn't seem like a good fit for a RESTful interface, though; enter Node.js.

I'd like to run my REST API from a node.js server, while still serving my site content from PHP. Is this a reasonable approach, and are there any potential troubles waiting in the wings? I'm planning on using express to simplify the process of REST API development.

like image 284
Paul Sonier Avatar asked Aug 26 '26 17:08

Paul Sonier


2 Answers

PHP with Apache is enough to serve a proper RESTful interface. Being able to divide all your operations into proper resources and verbs is what REST needs. As REST is a way of designing an interface and now about the actual implementation, there are multiple ways of implementing it in PHP/Apache itself. I have used the Zend Framework for big APIs. For something super simple, a .htaccess with a PHP file should be good. :)

That said, I believe Node.js would give your API a nice performance advantage just after installing it. The actual numbers would depend upon how your backend works.

IMO, if you already have a lot of code in PHP and are not facing any performance issues, you can stick to the PHP+Apache combo than try out node.js.

like image 68
Abhinav Avatar answered Aug 28 '26 06:08

Abhinav


You can try Zend framework. It will simplify your RESTful API development.

like image 30
key2 Avatar answered Aug 28 '26 06:08

key2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!