Changes between Version 26 and Version 27 of members/GRIP-UQAM/Javascript
- Timestamp:
- Apr 4, 2017, 11:51:50 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
members/GRIP-UQAM/Javascript
v26 v27 133 133 * [[Image(https://nodei.co/npm/mapleTree.png?downloads=true&downloadRank=true&stars=true, link=https://nodei.co/npm/mapleTree/, title=saambarati/mapleTree)]] 134 134 * [[Image(https://nodei.co/npm/#.png?downloads=true&downloadRank=true&stars=true, link=https://nodei.co/npm/#/, title=)]] 135 {{{#!js 136 var route = require('path-match')({ 137 // path-to-regexp options 138 sensitive: false, 139 strict: false, 140 end: false, 141 }); 142 143 // create a match function from a route 144 var match = route('/post/:id'); 145 146 // match a route 147 var parse = require('url').parse; 148 require('http').createServer(function (req, res) { 149 var params = match(parse(req.url).pathname); 150 151 // no match 152 if (params === false) { 153 res.statusCode = 404; 154 res.end(); 155 return; 156 } 157 158 // the matched id 159 var id = params.id; 160 161 // do stuff with the ID 162 }) 163 }}} 135 164 == Authentication == 136 165 * [[Image(https://nodei.co/npm/passport.png?downloads=true&downloadRank=true&stars=true, link=https://nodei.co/npm/passport/, title=jaredhanson/passport)]][[Image(https://qa.debian.org/cgi-bin/popcon-png?packages=node-passport&show_installed=on&date_fmt=%25Y, 9%, link=https://tracker.debian.org/pkg/passportjs, title="debian: passportjs")]]