-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (25 loc) · 796 Bytes
/
Copy pathserver.js
File metadata and controls
32 lines (25 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var connect = require('connect');
var http = require('http');
//connect dispatcher; takes rqst & resp arguments
// convention to call it 'app'
var app = connect();
function doFirst( request, response, next ) {
console.log("squirel");
// optional "next" for specific directing to another call; else this function just returns to the caller
next();
}
function doSecond( request, response, next ) {
console.log("ball");
next();
}
function profile( request, response, next) {
console.log("profile page code");
next();
}
// use the given "middleware" handle (function) for the given route (url-path, default '/')
app.use("/profile", profile);
app.use(doFirst);
app.use(doSecond);
http.createServer(app).listen(8888);
console.log("Server is running");
app