SlideShare a Scribd company logo
from	
  basic	
  to	
  middle
clonnhttp://about.me/clonn
Expressjs
Thursday, September 5, 13
Caesar Chi
clonncd
Thursday, September 5, 13
• node
• npm
• git
• grunt.js (optional)
Material
Thursday, September 5, 13
• http://expressjs.com
• https://github.com/visionmedia/express/wiki
Thursday, September 5, 13
• npm install -g express
• maybe you will use “sudo”
• make express work well
Basic
Thursday, September 5, 13
• express as cli
• -e (ejs), -j (jshtml), -H (hogan)
• -c (css)
• -h (call help)
• -v (version)
• -s (session)
Basic
Thursday, September 5, 13
• express as cli
• -e (ejs), -j (jshtml), -H (hogan)
• -c (css)
• -h (call help)
• -v (version)
• -s (session)
Basic
Thursday, September 5, 13
• express as cli
• -e (ejs), -j (jshtml), -H (hogan)
• -c (css)
• -h (call help)
• -v (version)
• -s (session)
Basic
Thursday, September 5, 13
• express as cli
• -e (ejs), -j (jshtml), -H (hogan)
• -c (css)
• -h (call help)
• -v (version)
• -s (session)
Basic
Thursday, September 5, 13
• express as cli
• -e (ejs), -j (jshtml), -H (hogan)
• jade (as default)
Basic
Thursday, September 5, 13
• express as cli
• -e (ejs), -j (jshtml), -H (hogan)
• jade (as default)
Basic
They are Template engine
Thursday, September 5, 13
• Why need template engine?
Basic
Thursday, September 5, 13
• Why need template engine?
Basic
•user-data
•cargo-list
•cache-store
Thursday, September 5, 13
• Why need template engine?
Basic
•user-data
•cargo-list
•cache-store
Thursday, September 5, 13
• Why need template engine?
Basic
•user-data
•cargo-list
•cache-store We need Template engine
Thursday, September 5, 13
We need
Template engine
MVC (i hate u)
Because
Thursday, September 5, 13
• express as cli
• -css (default css)
• stylus (as default)
Basic
Thursday, September 5, 13
• express as cli
• -css (default css)
• stylus will compile to pure CSS in static
folder
Basic
Thursday, September 5, 13
• run express cli
• express [-option] [application_name]
Basic
Thursday, September 5, 13
• run express cli
• express [-option] [application_name]
Basic
Thursday, September 5, 13
• run express cli
• express [-option] [application_name]
Basic
Thursday, September 5, 13
• run express cli
Basic
Thursday, September 5, 13
• run express cli
Basic
Thursday, September 5, 13
• run express cli
Basic
Thursday, September 5, 13
• run express cli
Basic
Thursday, September 5, 13
Now you know
Express-cli
as well
Thursday, September 5, 13
• folder structure
Content
Thursday, September 5, 13
• folder structure
Content
npm package config
Thursday, September 5, 13
• folder structure
Content
init file (app.js)
Thursday, September 5, 13
• folder structure
Content
static folder
Thursday, September 5, 13
• folder structure
Content
route setting
Thursday, September 5, 13
• folder structure
Content
view folder
Thursday, September 5, 13
it is basic
Express
folder structure
Thursday, September 5, 13
• Setting in Express
• app.listen
Middle
Thursday, September 5, 13
• Setting in Express
• app.configure
Middle
read environment variable
Thursday, September 5, 13
• Setting in Express
• app.set, app.get
• app.enable, app.disable
Middle
http://expressjs.com/api.html#app-settings
Thursday, September 5, 13
• Setting in Express
• app.use
Middle
middleware
route
view
Thursday, September 5, 13
• Setting in Express
• app.use
Middle
middleware
route
view
app.use, will execute every route
Thursday, September 5, 13
• Setting in Express
• app.get,
• app.post,
• app.delete,
• app.update
Middle
middleware
route
view
Thursday, September 5, 13
• Setting in Express
• app.all
• app.get,
• app.post,
• app.delete,
• app.update
Middle
middleware
route
view
Thursday, September 5, 13
• Setting in Express
• app.locals
Middle
•user-data
•cargo-list
•cache-store
if those parameters are default
Thursday, September 5, 13
it is middleware
Express
app original method
Thursday, September 5, 13
• req get parameter
• req.params
Request
id = 3
Thursday, September 5, 13
• req get parameter
• req.query
Request
getId = 30
Thursday, September 5, 13
• req get parameter
• req.body
Request
Thursday, September 5, 13
• req get parameter
• req.body
Request
Thursday, September 5, 13
• req get parameter
• req.files
Request
Thursday, September 5, 13
• req get cookie
• req.cookies (read cookie)
Request
Thursday, September 5, 13
• req about HEADER (read only)
• req.get, req.header
• req.is
• req.ip, req.ips
• req.host (req.subdomains)
• req.protocol, (req.secure -> 'https' == req.protocol;)
Request
Thursday, September 5, 13
• req about HEADER (read only)
• req.xhr
Request
Thursday, September 5, 13
• req about HEADER (read only)
• req.xhr
Request
Thursday, September 5, 13
• req about HEADER (read only)
• req.xhr
Request
Thursday, September 5, 13
Request is
READ only
in ExpressJS
Thursday, September 5, 13
• res about HEADER
• res.status (res.statusCode)
Response
(code only)
Thursday, September 5, 13
• res about HEADER
• res.clearCookie
Response
Thursday, September 5, 13
• res about HEADER
• res.set, res.header
Response
Thursday, September 5, 13
• res about parameters
• res.locals (app.locals is different)
Response
life cycle is only in url period.
Thursday, September 5, 13
• res client render
• res.redirect
Response
Thursday, September 5, 13
• res client render
• res.json, res.send
Response
HEADER: application/json
Thursday, September 5, 13
• res client render
• res.download
Response
Thursday, September 5, 13
• res client render
• res.render
Response
Thursday, September 5, 13
Response write data
in Express
Thursday, September 5, 13
more?
Thursday, September 5, 13
change middleware
https://github.com/visionmedia/express/wiki
Thursday, September 5, 13
cross domain access
http://stackoverflow.com/questions/11181546/node-js-express-cross-domain-scripting
Thursday, September 5, 13
co-work with angularjs
https://github.com/btford/angular-socket-io-im
Thursday, September 5, 13
future!!!
Thursday, September 5, 13
express 4.x roadmap.
https://github.com/visionmedia/express/wiki/4.x-roadmap
Thursday, September 5, 13
Q & A?
Thursday, September 5, 13
Advertising
Thursday, September 5, 13
http://nodejs.tw/
Thursday, September 5, 13
http://book.nodejs.tw/
Thursday, September 5, 13
http://nodeknockout.nodejs.tw/
2013/Nov/8 - 10
Thursday, September 5, 13

More Related Content

PDF
ZIP
Redis and Ohm
PPTX
Commitmas 2015
PPTX
Parse, scale to millions
PPT
Linux basics by Raj Miraje
PPTX
Value protocols and codables
PDF
Monitoring Behavioral Driven Infrastructures mit Cucumber-Nagios by Mike Adolphs
PPTX
Php7 hhvm and co
Redis and Ohm
Commitmas 2015
Parse, scale to millions
Linux basics by Raj Miraje
Value protocols and codables
Monitoring Behavioral Driven Infrastructures mit Cucumber-Nagios by Mike Adolphs
Php7 hhvm and co

Viewers also liked (20)

PPTX
Express js
PDF
Express node js
PPTX
Building Web Apps with Express
PDF
Create Restful Web Application With Node.js Express Framework
PPTX
Node.js Express
PPTX
Generics of JAVA
PPT
2CPP15 - Templates
PDF
Use the @types, Luke
PDF
On Parameterised Types and Java Generics
PDF
Realtime web applications with ExpressJS and SocketIO
PDF
Socket.IO - Alternative Ways for Real-time Application
PDF
Enterprise Tic-Tac-Toe
PDF
Pizza compiler
PDF
Anatomy of a Modern Node.js Application Architecture
PDF
Nodejs Explained with Examples
PPTX
Introduction to Node.js
PDF
Functional Programming Patterns (NDC London 2014)
PPTX
Cabalgata de Reyes La Victoria de Acentejo
PPTX
Medios de transmisión 1
PPS
BEAUTY OF COLOURS
Express js
Express node js
Building Web Apps with Express
Create Restful Web Application With Node.js Express Framework
Node.js Express
Generics of JAVA
2CPP15 - Templates
Use the @types, Luke
On Parameterised Types and Java Generics
Realtime web applications with ExpressJS and SocketIO
Socket.IO - Alternative Ways for Real-time Application
Enterprise Tic-Tac-Toe
Pizza compiler
Anatomy of a Modern Node.js Application Architecture
Nodejs Explained with Examples
Introduction to Node.js
Functional Programming Patterns (NDC London 2014)
Cabalgata de Reyes La Victoria de Acentejo
Medios de transmisión 1
BEAUTY OF COLOURS
Ad

Similar to Expressjs basic to advance, power by Node.js (20)

PDF
Ruby 2.0 / Rails 4.0, A selection of new features.
PDF
Front-end development automation with Grunt
PDF
Mastering ElasticSearch with Ruby and Tire
PDF
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PDF
Cooking an Omelette with Chef
PDF
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
PDF
Filesystem Management with Flysystem at PHP UK 2023
PDF
Ab(Using) the MetaCPAN API for Fun and Profit v2013
PDF
JavaScript 1.8.5: New Features Explored
PPTX
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
PPTX
Puppet camp chicago-automated_testing2
PDF
Filesystem Management with Flysystem - php[tek] 2023
PPTX
Ansible presentation
PDF
Cors
PDF
Introduction to Express and Grunt
PDF
Qt Design Patterns
PDF
Scaling PHP to 40 Million Uniques
PDF
Unit 12 finding and processing files
PDF
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
PDF
The Spring 4 Update - Josh Long
Ruby 2.0 / Rails 4.0, A selection of new features.
Front-end development automation with Grunt
Mastering ElasticSearch with Ruby and Tire
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
Cooking an Omelette with Chef
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Filesystem Management with Flysystem at PHP UK 2023
Ab(Using) the MetaCPAN API for Fun and Profit v2013
JavaScript 1.8.5: New Features Explored
Automated Puppet Testing - PuppetCamp Chicago '12 - Scott Nottingham
Puppet camp chicago-automated_testing2
Filesystem Management with Flysystem - php[tek] 2023
Ansible presentation
Cors
Introduction to Express and Grunt
Qt Design Patterns
Scaling PHP to 40 Million Uniques
Unit 12 finding and processing files
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
The Spring 4 Update - Josh Long
Ad

More from Caesar Chi (20)

PDF
為何技術老人這樣想那樣做?
PDF
面試AI技術大進化,加速招聘軟體工程師的全套攻略!
PDF
初探工程師升級手冊 2022
PDF
預約及客服 LINE 服務串接大挑戰
PDF
Remote monitoring widget setup and customization
PDF
JS 從 Non-type 到 Type 的愛恨情仇
PDF
LINE@ 2.0 offline to online
PDF
Chatbot 智能溝通策 流程規劃與實做 e-Commerce Chatbot - AI strategy and Chat bot user flow
PDF
PWA and Chatbot - with e-Commerce experience sharing
PDF
Morden F2E Education - Think of Progressive Web Apps
PDF
codecept.js introduce - front end test E2E tool introduce
PDF
遠端團隊專案建立與管理 remote team management 2016
PDF
Introduce Angular2 & render & firebase flow
PDF
如何提昇技術力 - 參與技術社群之經驗分享
PDF
html5 & phonegap
PDF
From devOps to front end Ops, test first
PDF
Docker with Cloud Service GCPUG
PDF
從失敗中學習打造技術團隊
PDF
Docker with Cloud Service
PDF
技術單兵作戰及團隊開發流程差異
為何技術老人這樣想那樣做?
面試AI技術大進化,加速招聘軟體工程師的全套攻略!
初探工程師升級手冊 2022
預約及客服 LINE 服務串接大挑戰
Remote monitoring widget setup and customization
JS 從 Non-type 到 Type 的愛恨情仇
LINE@ 2.0 offline to online
Chatbot 智能溝通策 流程規劃與實做 e-Commerce Chatbot - AI strategy and Chat bot user flow
PWA and Chatbot - with e-Commerce experience sharing
Morden F2E Education - Think of Progressive Web Apps
codecept.js introduce - front end test E2E tool introduce
遠端團隊專案建立與管理 remote team management 2016
Introduce Angular2 & render & firebase flow
如何提昇技術力 - 參與技術社群之經驗分享
html5 & phonegap
From devOps to front end Ops, test first
Docker with Cloud Service GCPUG
從失敗中學習打造技術團隊
Docker with Cloud Service
技術單兵作戰及團隊開發流程差異

Recently uploaded (20)

PDF
Executive an important link between the legislative and people
PDF
hbs_mckinsey_global_energy_perspective_2021.pdf
PPTX
Richard Smith and First Zurich trust scam.pptx
PPTX
PPT on SardarPatel and Popular Media.pptx
PPTX
200 years old story of a paradise on earth
PDF
JUDICIAL_ACTIVISM_CRITICAL_ANALYSIS in india.pdf
PDF
Tran Quoc Bao led Top 3 Social Influencers Transforming Healthcare & Life Sci...
PDF
Mathura Sridharan's Appointment as Ohio Solicitor General Sparks Racist Backl...
DOCX
Breaking Now – Latest Live News Updates from GTV News HD
PDF
Supereme Court history functions and reach.pdf
PDF
03082025_First India Newspaper Jaipur.pdf
PDF
Theories of federalism showcasing india .pdf
PDF
Role of federalism in the indian society
PDF
ACFrOgB7qGIQ8bhzZH1Pzz4DLzOiKY24QMUch6D2DeHr9Wmm6Me1clS-AgTR6FhMOpbl2iwGlABTp...
PPTX
Final The-End-of-the-Cold-War-and-the-Emergence-of-a-Unipolar-World.pptx
DOCX
Meme Coins news - memecoinist website platform
PDF
01082025_First India Newspaper Jaipur.pdf
PDF
62 America is Mentally Ill 20.pdf Politicians Promoting Violence
PPTX
OBG. ABNORAMLTIES OF THE PUERPERIUM, BSC
PPTX
opher bryers alert -How Opher Bryer’s Impro.ai Became the Center of Israel’s ...
Executive an important link between the legislative and people
hbs_mckinsey_global_energy_perspective_2021.pdf
Richard Smith and First Zurich trust scam.pptx
PPT on SardarPatel and Popular Media.pptx
200 years old story of a paradise on earth
JUDICIAL_ACTIVISM_CRITICAL_ANALYSIS in india.pdf
Tran Quoc Bao led Top 3 Social Influencers Transforming Healthcare & Life Sci...
Mathura Sridharan's Appointment as Ohio Solicitor General Sparks Racist Backl...
Breaking Now – Latest Live News Updates from GTV News HD
Supereme Court history functions and reach.pdf
03082025_First India Newspaper Jaipur.pdf
Theories of federalism showcasing india .pdf
Role of federalism in the indian society
ACFrOgB7qGIQ8bhzZH1Pzz4DLzOiKY24QMUch6D2DeHr9Wmm6Me1clS-AgTR6FhMOpbl2iwGlABTp...
Final The-End-of-the-Cold-War-and-the-Emergence-of-a-Unipolar-World.pptx
Meme Coins news - memecoinist website platform
01082025_First India Newspaper Jaipur.pdf
62 America is Mentally Ill 20.pdf Politicians Promoting Violence
OBG. ABNORAMLTIES OF THE PUERPERIUM, BSC
opher bryers alert -How Opher Bryer’s Impro.ai Became the Center of Israel’s ...

Expressjs basic to advance, power by Node.js