Expressjs basic to advance, power by Node.js
Upcoming SlideShare
Loading in...5
×
 

Expressjs basic to advance, power by Node.js

on

  • 2,456 views

introduce express framework, a node.js web framework. Anyone if you try using node.js, should be know express framework. However did you really know about Expressjs. This slide will give you a totally ...

introduce express framework, a node.js web framework. Anyone if you try using node.js, should be know express framework. However did you really know about Expressjs. This slide will give you a totally common sense in Expressjs.

Statistics

Views

Total Views
2,456
Views on SlideShare
2,438
Embed Views
18

Actions

Likes
12
Downloads
48
Comments
2

1 Embed 18

https://twitter.com 18

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Expressjs basic to advance, power by Node.js Expressjs basic to advance, power by Node.js Presentation Transcript

  • 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