Produced by Araxis Merge on 10/24/2017 6:38:24 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CHAMP_VA1.zip\CHAMP_VA1\app\node_modules\helmet\node_modules\connect | Readme.md | Mon Oct 16 21:06:50 2017 UTC |
| 2 | CHAMP_VA1.zip\CHAMP_VA1\app\node_modules\helmet\node_modules\connect | Readme.md | Thu Oct 19 20:04:32 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 386 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | # Connect | |
| 2 | ||
| 3 | [![NPM Ver sion][npm- image]][np m-url] | |
| 4 | [![NPM Dow nloads][do wnloads-im age]][down loads-url] | |
| 5 | [![Build S tatus][tra vis-image] ][travis-u rl] | |
| 6 | [![Test Co verage][co veralls-im age]][cove ralls-url] | |
| 7 | [![Gratipa y][gratipa y-image]][ gratipay-u rl] | |
| 8 | ||
| 9 | Connect is an exte nsible HTT P server f ramework f or [node]( http://nod ejs.org) u sing "plug ins" known as _middl eware_. | |
| 10 | ||
| 11 | ```js | |
| 12 | var connec t = requir e('connect '); | |
| 13 | var http = require(' http'); | |
| 14 | ||
| 15 | var app = connect(); | |
| 16 | ||
| 17 | // gzip/de flate outg oing respo nses | |
| 18 | var compre ssion = re quire('com pression') ; | |
| 19 | app.use(co mpression( )); | |
| 20 | ||
| 21 | // store s ession sta te in brow ser cookie | |
| 22 | var cookie Session = require('c ookie-sess ion'); | |
| 23 | app.use(co okieSessio n({ | |
| 24 | keys: [' PW 1', ' PW 2'] | |
| 25 | })); | |
| 26 | ||
| 27 | // parse u rlencoded request bo dies into req.body | |
| 28 | var bodyPa rser = req uire('body -parser'); | |
| 29 | app.use(bo dyParser.u rlencoded( )); | |
| 30 | ||
| 31 | // respond to all re quests | |
| 32 | app.use(fu nction(req , res){ | |
| 33 | res.end( 'Hello fro m Connect! \n'); | |
| 34 | }); | |
| 35 | ||
| 36 | //create n ode.js htt p server a nd listen on port | |
| 37 | http.creat eServer(ap p).listen( 3000); | |
| 38 | ``` | |
| 39 | ||
| 40 | ## Getting Started | |
| 41 | ||
| 42 | Connect is a simple framework to glue to gether var ious "midd leware" to handle re quests. | |
| 43 | ||
| 44 | ### Instal l Connect | |
| 45 | ||
| 46 | ```sh | |
| 47 | $ npm inst all connec t | |
| 48 | ``` | |
| 49 | ||
| 50 | ### Create an app | |
| 51 | ||
| 52 | The main c omponent i s a Connec t "app". T his will s tore all t he middlew are | |
| 53 | added and is, itself , a functi on. | |
| 54 | ||
| 55 | ```js | |
| 56 | var app = connect(); | |
| 57 | ``` | |
| 58 | ||
| 59 | ### Use mi ddleware | |
| 60 | ||
| 61 | The core o f Connect is "using" middlewar e. Middlew are are ad ded as a " stack" | |
| 62 | where inco ming reque sts will e xecute eac h middlewa re one-by- one until a middlewa re | |
| 63 | does not c all `next( )` within it. | |
| 64 | ||
| 65 | ```js | |
| 66 | app.use(fu nction mid dleware1(r eq, res, n ext) { | |
| 67 | // middl eware 1 | |
| 68 | next(); | |
| 69 | }); | |
| 70 | app.use(fu nction mid dleware2(r eq, res, n ext) { | |
| 71 | // middl eware 2 | |
| 72 | next(); | |
| 73 | }); | |
| 74 | ``` | |
| 75 | ||
| 76 | ### Mount middleware | |
| 77 | ||
| 78 | The `.use( )` method also takes an option al path st ring that is matched against | |
| 79 | the beginn ing of the incoming request UR L. This al lows for b asic routi ng. | |
| 80 | ||
| 81 | ```js | |
| 82 | app.use('/ foo', func tion fooMi ddleware(r eq, res, n ext) { | |
| 83 | // req.u rl starts with "/foo " | |
| 84 | next(); | |
| 85 | }); | |
| 86 | app.use('/ bar', func tion barMi ddleware(r eq, res, n ext) { | |
| 87 | // req.u rl starts with "/bar " | |
| 88 | next(); | |
| 89 | }); | |
| 90 | ``` | |
| 91 | ||
| 92 | ### Error middleware | |
| 93 | ||
| 94 | There are special ca ses of "er ror-handli ng" middle ware. Ther e are midd leware | |
| 95 | where the function t akes exact ly 4 argum ents. Erro rs that oc cur in the middlewar e | |
| 96 | added befo re the err or middlew are will i nvoke this middlewar e when err ors occur. | |
| 97 | ||
| 98 | ```js | |
| 99 | app.use(fu nction one rror(err, req, res, next) { | |
| 100 | // an er ror occurr ed! | |
| 101 | }); | |
| 102 | ``` | |
| 103 | ||
| 104 | ### Create a server from the a pp | |
| 105 | ||
| 106 | The last s tep is to actually u se the Con nect app i n a server . The `.li sten()` me thod | |
| 107 | is a conve nience to start a HT TP server. | |
| 108 | ||
| 109 | ```js | |
| 110 | var server = app.lis ten(port); | |
| 111 | ``` | |
| 112 | ||
| 113 | The app it self is re ally just a function with thre e argument s, so it c an also be handed | |
| 114 | to `.creat eServer()` in Node.j s. | |
| 115 | ||
| 116 | ```js | |
| 117 | var server = http.cr eateServer (app); | |
| 118 | ``` | |
| 119 | ||
| 120 | ## Middlew are | |
| 121 | ||
| 122 | These midd leware and libraries are offic ially supp orted by t he Connect /Express t eam: | |
| 123 | ||
| 124 | - [body- parser](ht tps://www. npmjs.com/ package/bo dy-parser) - previou s `bodyPar ser`, `jso n`, and `u rlencoded` . You may also be in terested i n: | |
| 125 | - [bod y](https:/ /www.npmjs .com/packa ge/body) | |
| 126 | - [co- body](http s://www.np mjs.com/pa ckage/co-b ody) | |
| 127 | - [raw -body](htt ps://www.n pmjs.com/p ackage/raw -body) | |
| 128 | - [compr ession](ht tps://www. npmjs.com/ package/co mpression) - previou sly `compr ess` | |
| 129 | - [conne ct-timeout ](https:// www.npmjs. com/packag e/connect- timeout) - previousl y `timeout ` | |
| 130 | - [cooki e-parser]( https://ww w.npmjs.co m/package/ cookie-par ser) - pre viously `c ookieParse r` | |
| 131 | - [cooki e-session] (https://w ww.npmjs.c om/package /cookie-se ssion) - p reviously `cookieSes sion` | |
| 132 | - [csurf ](https:// www.npmjs. com/packag e/csurf) - previousl y `csrf` | |
| 133 | - [error handler](h ttps://www .npmjs.com /package/e rrorhandle r) - previ ously `err or-handler ` | |
| 134 | - [expre ss-session ](https:// www.npmjs. com/packag e/express- session) - previousl y `session ` | |
| 135 | - [metho d-override ](https:// www.npmjs. com/packag e/method-o verride) - previousl y `method- override` | |
| 136 | - [morga n](https:/ /www.npmjs .com/packa ge/morgan) - previou sly `logge r` | |
| 137 | - [respo nse-time]( https://ww w.npmjs.co m/package/ response-t ime) - pre viously `r esponse-ti me` | |
| 138 | - [serve -favicon]( https://ww w.npmjs.co m/package/ serve-favi con) - pre viously `f avicon` | |
| 139 | - [serve -index](ht tps://www. npmjs.com/ package/se rve-index) - previou sly `direc tory` | |
| 140 | - [serve -static](h ttps://www .npmjs.com /package/s erve-stati c) - previ ously `sta tic` | |
| 141 | - [vhost ](https:// www.npmjs. com/packag e/vhost) - previousl y `vhost` | |
| 142 | ||
| 143 | Most of th ese are ex act ports of their C onnect 2.x equivalen ts. The pr imary exce ption is ` cookie-ses sion`. | |
| 144 | ||
| 145 | Some middl eware prev iously inc luded with Connect a re no long er support ed by the Connect/Ex press team , are repl aced by an alternati ve module, or should be supers eded by a better mod ule. Use o ne of thes e alternat ives inste ad: | |
| 146 | ||
| 147 | - `cooki eParser` | |
| 148 | - [coo kies](http s://www.np mjs.com/pa ckage/cook ies) and [ keygrip](h ttps://www .npmjs.com /package/k eygrip) | |
| 149 | - `limit ` | |
| 150 | - [raw -body](htt ps://www.n pmjs.com/p ackage/raw -body) | |
| 151 | - `multi part` | |
| 152 | - [con nect-multi party](htt ps://www.n pmjs.com/p ackage/con nect-multi party) | |
| 153 | - [con nect-busbo y](https:/ /www.npmjs .com/packa ge/connect -busboy) | |
| 154 | - `query ` | |
| 155 | - [qs] (https://w ww.npmjs.c om/package /qs) | |
| 156 | - `stati cCache` | |
| 157 | - [st] (https://w ww.npmjs.c om/package /st) | |
| 158 | - [con nect-stati c](https:/ /www.npmjs .com/packa ge/connect -static) | |
| 159 | ||
| 160 | Checkout [ http-frame work](http s://github .com/Rayno s/http-fra mework/wik i/Modules) for many other comp atible mid dleware! | |
| 161 | ||
| 162 | ## Running Tests | |
| 163 | ||
| 164 | ```bash | |
| 165 | npm instal l | |
| 166 | npm test | |
| 167 | ``` | |
| 168 | ||
| 169 | ## Contrib utors | |
| 170 | ||
| 171 | https://g ithub.com/ senchalabs /connect/g raphs/cont ributors | |
| 172 | ||
| 173 | ## Node Co mpatibilit y | |
| 174 | ||
| 175 | - Connec t `< 1.x` - node `0. 2` | |
| 176 | - Connec t `1.x` - node `0.4` | |
| 177 | - Connec t `< 2.8` - node `0. 6` | |
| 178 | - Connec t `>= 2.8 < 3` - nod e `0.8` | |
| 179 | - Connec t `>= 3` - node `0.1 0`, `0.12` ; io.js `1 .x`, `2.x` | |
| 180 | ||
| 181 | ## License | |
| 182 | ||
| 183 | [MIT](LICE NSE) | |
| 184 | ||
| 185 | [npm-image ]: https:/ /img.shiel ds.io/npm/ v/connect. svg | |
| 186 | [npm-url]: https://n pmjs.org/p ackage/con nect | |
| 187 | [travis-im age]: http s://img.sh ields.io/t ravis/senc halabs/con nect/maste r.svg | |
| 188 | [travis-ur l]: https: //travis-c i.org/senc halabs/con nect | |
| 189 | [coveralls -image]: h ttps://img .shields.i o/coverall s/senchala bs/connect /master.sv g | |
| 190 | [coveralls -url]: htt ps://cover alls.io/r/ senchalabs /connect | |
| 191 | [downloads -image]: h ttps://img .shields.i o/npm/dm/c onnect.svg | |
| 192 | [downloads -url]: htt ps://npmjs .org/packa ge/connect | |
| 193 | [gratipay- image]: ht tps://img. shields.io /gratipay/ dougwilson .svg | |
| 194 | [gratipay- url]: http s://www.gr atipay.com /dougwilso n/ |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.