Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Express.js

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.
Avatar for Sopheak Kong Sopheak Kong
September 23, 2014

 Express.js

Avatar for Sopheak Kong

Sopheak Kong

September 23, 2014
Tweet

Other Decks in Programming

Transcript

  1. What is Express.js? ™  A light-weight web application framework ™ 

    To help organize a web application ™  MVC architecture on the server side
  2. What is the purpose of it with Node.js? ™  No

    need to repeat same code over and over again ™  Node.js is a low-level I/O mechanism which has an HTTP module ™  If using just an HTTP module, a lot of work will have to be re-implemented ™  For example parsing the payload, cookies, storing sessions, etc... ™  Express.js provides necessary functionalities to use with HTTP module
  3. How to install? ™  Require Node.js ™  Require express-generator package

    before you can generate an application ™  For global use:   ™  npm  install  –g  express-­‐generator  
  4. How to use? ™  First generate an application then install

    all the dependencies that it needs: 1.  $  express  expresstest   2.  $  cd  expresstest   3.  $  npm  install   4.  $  DEBUG=expresstest  ./bin/www     1.  $  nodeman  bin/www  
  5. Hogan.js, CSS and nodemon ™  $  express  –-­‐hogan  –c  less

      ™  $  npm  install  –g  nodemon   ™  $  nodemon  bin/www