Skip to content

Commit 46785cf

Browse files
committedAug 31, 2015
Update README.md
1 parent 938097d commit 46785cf

File tree

1 file changed

+45
-43
lines changed

1 file changed

+45
-43
lines changed
 

‎README.md

+45-43
Original file line numberDiff line numberDiff line change
@@ -13,58 +13,60 @@ feature.
1313

1414
Take the following example server:
1515

16-
var middleware = require('./middleware');
17-
18-
var app = middleware.createServer();
19-
20-
app.use(function (req, res, next) {
21-
res.write('a');
22-
next();
23-
});
24-
25-
app.use('/hello', function (req, res, next) {
26-
res.write('b');
27-
next();
28-
});
29-
30-
app.use(function (req, res, next) {
31-
res.write('c');
32-
next();
33-
});
34-
35-
app.use('/hello', function (req, res) {
36-
res.end('hello');
37-
});
38-
39-
app.use('/goodbye', function (req, res) {
40-
res.end('goodbye');
41-
});
42-
43-
app.use(function (req, res) {
44-
res.end('end');
45-
});
46-
47-
app.listen(3000, function () {
48-
console.log('Server started at 3000');
49-
});
50-
16+
```js
17+
var middleware = require('./middleware');
18+
var app = middleware.createServer();
19+
20+
app.use(function (req, res, next) {
21+
res.write('a');
22+
next();
23+
});
24+
25+
app.use('/hello', function (req, res, next) {
26+
res.write('b');
27+
next();
28+
});
29+
30+
app.use(function (req, res, next) {
31+
res.write('c');
32+
next();
33+
});
34+
35+
app.use('/hello', function (req, res) {
36+
res.end('hello');
37+
});
38+
39+
app.use('/goodbye', function (req, res) {
40+
res.end('goodbye');
41+
});
42+
43+
app.use(function (req, res) {
44+
res.end('end');
45+
});
46+
47+
app.listen(3000, function () {
48+
console.log('Server started at 3000');
49+
});
50+
```
5151

5252
Your micro-framework will implement at least 3 methods:
5353

54-
* `createServer()`
55-
* `use(handler)`
56-
* `listen(port, callback)`
54+
+ `createServer()`
55+
+ `use(handler)`
56+
+ `listen(port, callback)`
5757

5858
The above server will run as you would expect:
5959

60-
* `GET /hello` would return `abchello`
61-
* `GET /goodbye` would return `acgoodbye`
62-
* `GET /` would return `acend`
60+
+ `GET /hello` would return `abchello`
61+
+ `GET /goodbye` would return `acgoodbye`
62+
+ `GET /` would return `acend`
6363

6464
Do you have what it takes?
6565

6666

6767
## Usage
6868

69-
$ npm install
70-
$ npm test
69+
```sh
70+
$ npm install
71+
$ npm test
72+
```

0 commit comments

Comments
 (0)