File tree 4 files changed +52
-0
lines changed
4 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 36
36
],
37
37
"devDependencies" : {
38
38
"babel" : " ^5.8.23" ,
39
+ "connect" : " ^3.4.0" ,
39
40
"coveralls" : " ^2.11.4" ,
40
41
"eslint" : " ^1.3.0" ,
41
42
"eslint-plugin-markdown" : " git://github.com/eslint/eslint-plugin-markdown.git" ,
46
47
"gitbook-summary-to-path" : " ^1.0.1" ,
47
48
"jsdom" : " ^6.3.0" ,
48
49
"mocha" : " ^2.2.5" ,
50
+ "node-fetch" : " ^1.3.2" ,
49
51
"npm-run-all" : " ^1.2.8" ,
50
52
"power-assert" : " ^1.0.0" ,
51
53
"punctuate-coverage" : " ^1.0.3" ,
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+ var connect = require ( 'connect' ) ;
3
+ var http = require ( 'http' ) ;
4
+ var app = connect ( ) ;
5
+
6
+ // gzip/deflate outgoing responses
7
+ var compression = require ( 'compression' ) ;
8
+ app . use ( compression ( ) ) ;
9
+
10
+ // store session state in browser cookie
11
+ var cookieSession = require ( 'cookie-session' ) ;
12
+ app . use ( cookieSession ( {
13
+ keys : [ 'secret1' , 'secret2' ]
14
+ } ) ) ;
15
+ var bodyParser = require ( 'body-parser' ) ;
16
+ app . use ( bodyParser . urlencoded ( ) ) ;
17
+
18
+ // respond to all requests
19
+ app . use ( function ( req , res ) {
20
+ res . end ( 'Hello from Connect!\n' ) ;
21
+ } ) ;
22
+
23
+ //create node.js http server and listen on port
24
+ http . createServer ( app ) . listen ( 3000 ) ;
Original file line number Diff line number Diff line change
1
+ // LICENSE : MIT
2
+ "use strict" ;
3
+ export default function ( text ) {
4
+ return function ( req , res , next ) {
5
+ res . end ( text + "\n" ) ;
6
+ } ;
7
+ }
Original file line number Diff line number Diff line change
1
+ // LICENSE : MIT
2
+ "use strict" ;
3
+ var assert = require ( "power-assert" ) ;
4
+ import connect from "connect"
5
+ import hello from "../../src/connect/hello" ;
6
+
7
+ describe ( "hello" , function ( ) {
8
+ before ( function ( ) {
9
+ var connect = require ( 'connect' ) ;
10
+ var http = require ( 'http' ) ;
11
+ var app = connect ( ) ;
12
+ app . use ( hello ( "test" ) ) ;
13
+ http . createServer ( app ) . listen ( 3000 , done ) ;
14
+ } ) ;
15
+ after ( function ( done ) {
16
+ } ) ;
17
+ it ( "should return test" , function ( )
18
+ ) ;
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments