SlideShare a Scribd company logo
NODE.JS
WEB/DB/HOSTING
       허광남
   kenu@okjsp.pe.kr
NODE.JS WEB FRAMEWORK
      http://expressjs.com/
EXPRESS WEB FRAMEWORK

• Insanely     fast (and small)

• server-side     JavaScript web development framework

• built   on

  • [node](http://nodejs.org)

  • [Connect](http://github.com/senchalabs/connect)
var app = express.createServer();



app.get('/', function(req, res){

      res.send('Hello World');

});



app.listen(3000);
INSTALL



npm install express

npm install -g express
QUICK START


• Create   the app:

 •$   npm install -g express

 •$   express /tmp/foo && cd /tmp/foo
QUICK START

• Install   dependencies:

  •$   npm install -d



• Start     the server:

  •$   node app.js
STRUCTURE
FEATURES


* Robust routing
* Redirection helpers
* Dynamic view helpers
* Content negotiation
* Focus on high performance
* View rendering and partials support
FEATURES


* Environment based configuration
* Session based flash notifications
* Built on [Connect](http://github.com/senchalabs/connect)
* High test coverage
* Executable for generating applications quickly
* Application level view options
FEATURES
                VIA CONNECT
* Session support
* Cache API
* Mime helpers
* ETag support
* Persistent flash notifications
* Cookie support
* JSON-RPC
* Logging
* and _much_ more!
DEMO



• express   install && run
NODE.JS IN HOSTING
    http://www.heroku.com
HOSTING PAAS

• joyent

• heroku

• nodester

• cloud    foundry

• node    socket

• nodejitsu
HOSTING IAAS


• Amazon     EC2

• Rackspace

• joyent   cloud
HEROKU


• http://www.heroku.com/

• heroku   client

• foreman

• git
• Windows    xp DEMO

• http://devcenter.heroku.com/categories/node-js

 • foreman   .net framework v4.0.30319

 • http://msdn.microsoft.com/en-us/netframework/
  aa569263.aspx
NODE.JS WITH DB
https://github.com/sidorares/nodejs-mysql-native
MYSQL-NATIVE



• npm   install mysql-native
nodepad mysqltest.js
var db = require("mysql-native").createTCPClient();
db.auto_prepare = true;
function dump_rows(cmd)
{
    cmd.addListener('row', function(r) { console.dir(r); } );
}


db.auth("nodesample", "nodeuser", "password");
dump_rows(db.query("select 1+1,2,3,'4',length('hello')"));
dump_rows(db.execute("select 1+1,2,3,'4',length(?)", ["hello"]));
db.close();
• MySql   protocol documentation:

 • http://forge.mysql.com/wiki/
  MySQL_Internals_ClientServer_Protocol

• Other   node.js mysql clients:

 • http://github.com/felixge/node-mysql

 • http://github.com/Sannis/node-mysql-libmysqlclient

 • http://github.com/Guille/node.dbslayer.js
REFERENCES

• Node    Guide 번역

 • http://nodeguide.atelier.weaveus.com/

• Node.js   호스팅

 • http://inspiredjw.tistory.com/2

• Node.js   기술 요약 정리
 •   http://www.webresourcesdepot.com/the-awesome-node-js-and-its-gang/

More Related Content

Nodejs web,db,hosting

  • 1. NODE.JS WEB/DB/HOSTING 허광남 kenu@okjsp.pe.kr
  • 2. NODE.JS WEB FRAMEWORK http://expressjs.com/
  • 3. EXPRESS WEB FRAMEWORK • Insanely fast (and small) • server-side JavaScript web development framework • built on • [node](http://nodejs.org) • [Connect](http://github.com/senchalabs/connect)
  • 4. var app = express.createServer(); app.get('/', function(req, res){ res.send('Hello World'); }); app.listen(3000);
  • 5. INSTALL npm install express npm install -g express
  • 6. QUICK START • Create the app: •$ npm install -g express •$ express /tmp/foo && cd /tmp/foo
  • 7. QUICK START • Install dependencies: •$ npm install -d • Start the server: •$ node app.js
  • 9. FEATURES * Robust routing * Redirection helpers * Dynamic view helpers * Content negotiation * Focus on high performance * View rendering and partials support
  • 10. FEATURES * Environment based configuration * Session based flash notifications * Built on [Connect](http://github.com/senchalabs/connect) * High test coverage * Executable for generating applications quickly * Application level view options
  • 11. FEATURES VIA CONNECT * Session support * Cache API * Mime helpers * ETag support * Persistent flash notifications * Cookie support * JSON-RPC * Logging * and _much_ more!
  • 12. DEMO • express install && run
  • 13. NODE.JS IN HOSTING http://www.heroku.com
  • 14. HOSTING PAAS • joyent • heroku • nodester • cloud foundry • node socket • nodejitsu
  • 15. HOSTING IAAS • Amazon EC2 • Rackspace • joyent cloud
  • 16. HEROKU • http://www.heroku.com/ • heroku client • foreman • git
  • 17. • Windows xp DEMO • http://devcenter.heroku.com/categories/node-js • foreman .net framework v4.0.30319 • http://msdn.microsoft.com/en-us/netframework/ aa569263.aspx
  • 19. MYSQL-NATIVE • npm install mysql-native
  • 20. nodepad mysqltest.js var db = require("mysql-native").createTCPClient(); db.auto_prepare = true; function dump_rows(cmd) { cmd.addListener('row', function(r) { console.dir(r); } ); } db.auth("nodesample", "nodeuser", "password"); dump_rows(db.query("select 1+1,2,3,'4',length('hello')")); dump_rows(db.execute("select 1+1,2,3,'4',length(?)", ["hello"])); db.close();
  • 21. • MySql protocol documentation: • http://forge.mysql.com/wiki/ MySQL_Internals_ClientServer_Protocol • Other node.js mysql clients: • http://github.com/felixge/node-mysql • http://github.com/Sannis/node-mysql-libmysqlclient • http://github.com/Guille/node.dbslayer.js
  • 22. REFERENCES • Node Guide 번역 • http://nodeguide.atelier.weaveus.com/ • Node.js 호스팅 • http://inspiredjw.tistory.com/2 • Node.js 기술 요약 정리 • http://www.webresourcesdepot.com/the-awesome-node-js-and-its-gang/

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n