(ws14) sasa matijasic - node.js i "novi" web
TRANSCRIPT
Node ?
www.nodejs.org
server side javascript
google chrome V8
cross platform
PROS
● fast● C10K● asynchronous● libraries, npm● heroku, azure...● it's javascript
CONS
● not stable yet● it's javascript
Hello world PHPecho "Hello\n";sleep(5);echo "world\n";
Hello world Pythonprint "Hello"time.sleep(5)print "world"
Hello world NodesetTimeout(function () { console.log("world");}, 5000);console.log("Hello");
Web servervar http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n');}).listen(80);
npm install
● express, ...● ms-sql, mysql, postgresql,
oracle, ...● redis, mongo, ...● mustache, haml, ...● socket.io
npmjs.org
"10942 total packages"