Node.js for PHP Developers: Porting PHP to Node.js by Daniel Howard

By Daniel Howard

Daniel Howard, "Node.js for Hypertext Preprocessor builders: Porting personal home page to Node.js"
2013 | ISBN-10: 1449333605 | writer: O’Reilly Media | PDF | 288 pages | eight MB

If you’re an skilled personal home page developer, you have already got a head commence on studying how you can write Node.js code. during this e-book, writer Daniel Howard demonstrates the amazing similarities among the 2 languages, and indicates you the way to port all your Hypertext Preprocessor internet program to Node.js. by way of evaluating particular Hypertext Preprocessor good points with their Node opposite numbers, you’ll additionally observe find out how to refactor and increase latest personal home page four or Hypertext Preprocessor five resource code.

At the tip, you’ll have totally sensible codebases to supply for your clients. you could replace either one of them concurrently, utilizing this ebook as a connection with very important elements of Hypertext Preprocessor and Node.js.
Use an easy Node.js framework to transform person personal home page pages to Node.js files
Refactor blocking off personal home page resource code to non-blocking Node.js resource code that makes use of callbacks
Convert Hypertext Preprocessor syntax, variables, and kinds to Node.js
Use a step by step method for imposing personal home page periods and sophistication inheritance in Node.js
Convert Hypertext Preprocessor dossier dealing with APIs into their Node.js equivalents
Compare methods for utilizing a MySQL database in Node.js and PHP
Convert Hypertext Preprocessor code for JSON or XML APIs into Node.js code for npm applications

Show description

Read Online or Download Node.js for PHP Developers: Porting PHP to Node.js PDF

Similar development books

Build Your Own Website The Right Way Using HTML & CSS (3rd Edition)

With over 60,000 copies offered due to the fact that its first variation, this SitePoint best-seller has simply had a clean replace to incorporate contemporary advances within the internet industry.

With the 1st variations coming hugely urged via tested, top internet designers and builders, the 3rd variation with all its additional sweets will proceed that pattern. additionally totally up-to-date to incorporate the newest working structures, net browsers and supplying fixes to matters that experience cropped up because the final edition.

Readers will study to:
* kind textual content and keep watch over your web page structure with CSS
* Create and Optimize portraits for the internet
* upload interactivity in your websites with kinds
* comprise a customized seek, touch us web page, and a News/Events part in your web site
* music viewers with Google Analytics
* expand your succeed in and fasten your website with Social Media
* Use HTML5&CSS3 so as to add a few cool, polished beneficial properties in your website
* Use diagnosis/debug instruments to discover any difficulties
and many extra.

China’s Grain for Green Program: A Review of the Largest Ecological Restoration and Rural Development Program in the World

This booklet offers a finished evaluate of Grain for eco-friendly, China’s national application which will pay farmers to revert sloping or marginal farm land to bushes or grass. this system goals to enhance the ecological stipulations of a lot of China, and the socioeconomic conditions of hundreds of thousands of hundreds of thousands of individuals.

Teaching and Learning in Lower Secondary Schools in the Era of PISA and TIMSS

This ebook explores educating and studying in reduce secondary school rooms within the 3 PISA domain names technological know-how, arithmetic and interpreting. in keeping with huge video documentation from technological know-how, math and interpreting study rooms in Norwegian secondary education, it analyzes how provided and skilled educating and studying possibilities in those 3 topic parts help scholars’ studying.

Extra info for Node.js for PHP Developers: Porting PHP to Node.js

Example text

Php file. njs. php file. njs file as an HTTP response will be erased. js code that does the exact same thing. But we are not quite ready to do that yet. js Framework Predefined PHP Variables When a web server that supports PHP executes a PHP page, it does not supply a raw HTTP request to the PHP page and then execute the page. If it did that, every PHP page would have to add a lot of code to decode the raw HTTP request and put the values in a more convenient format. Instead, the PHP engine decodes the raw HTTP request itself and populates a bunch of well-known PHP global variables with the equivalent data.

The name becomes the key or index into the $_GET array, and the value becomes, well, the value. js still expects these predefined arrays to exist and to be correctly populated. js initGET() function takes three arguments: req, pre, and cb. The req argument contains the raw HTTP request. js object that contains all the predefined global variables, which are made available by the PHP engine to PHP pages. Instead of juggling a bunch of different variables, all predefined variables are stored in a pre variable that can be easily passed around.

So, a PHP page can be looked at as a single monolith of eventless code sandwiched between two events.

Download PDF sample

Rated 4.66 of 5 – based on 42 votes