Skip to content

Commit eb58336

Browse files
committed
Regarding to:
http://blog.tompawlak.org/new-features-node-express-4 Many middlewares are now external deps, and app.configure no longer exists.
1 parent 246b1b6 commit eb58336

File tree

7 files changed

+54
-57
lines changed

7 files changed

+54
-57
lines changed

Readme.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ The module provides two middlewares, one for authorization and routing, another
1414

1515
```js
1616
var express = require('express'),
17-
oauthserver = require('node-oauth2-server');
17+
bodyParser = require('body-parser'),
18+
oauthserver = require('node-oauth2-server');
1819

1920
var app = express();
2021

21-
app.configure(function() {
22-
app.oauth = oauthserver({
23-
model: {}, // See below for specification
24-
grants: ['password'],
25-
debug: true
26-
});
27-
app.use(express.bodyParser()); // REQUIRED
22+
app.use(bodyParser()); // REQUIRED
23+
24+
app.oauth = oauthserver({
25+
model: {}, // See below for specification
26+
grants: ['password'],
27+
debug: true
2828
});
2929

3030
app.all('/oauth/token', app.oauth.grant());

examples/dynamodb/Readme.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ For example:
1515
```js
1616
...
1717

18+
app.use(bodyParser());
1819

19-
app.configure(function() {
20-
app.oauth = oauthserver({
21-
model: require('./model'),
22-
grants: ['password', 'refresh_token'],
23-
debug: true
24-
});
25-
app.use(express.bodyParser());
20+
app.oauth = oauthserver({
21+
model: require('./model'),
22+
grants: ['password', 'refresh_token'],
23+
debug: true
2624
});
2725

2826
...

examples/dynamodb/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
var express = require('express'),
2+
bodyParser = require('body-parser'),
23
oauthserver = require('../../'); // Would be: 'node-oauth2-server'
34

45
var app = express();
56

6-
app.configure(function() {
7-
app.oauth = oauthserver({
8-
model: require('./model'),
9-
grants: ['password', 'refresh_token'],
10-
debug: true
11-
});
12-
app.use(express.bodyParser());
7+
app.use(bodyParser());
8+
9+
app.oauth = oauthserver({
10+
model: require('./model'),
11+
grants: ['password', 'refresh_token'],
12+
debug: true
1313
});
1414

1515
// Handle token grant requests

examples/memory/Readme.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@ For example:
1212

1313
var express = require('express'),
1414
oauthserver = require('node-oauth2-server'),
15-
memorystore = require("./model");
15+
bodyParser = require('body-parser'),
16+
memorystore = require('./model');
1617

1718
var app = express();
1819

19-
app.configure(function() {
20-
var oauth = oauthserver({
21-
model: memorystore,
22-
grants: ['password','refresh_token'],
23-
debug: true
24-
});
25-
app.use(express.bodyParser()); // REQUIRED
26-
app.use(oauth.handler());
27-
app.use(oauth.errorHandler());
20+
app.use(bodyParser()); // REQUIRED
21+
22+
var oauth = oauthserver({
23+
model: memorystore,
24+
grants: ['password','refresh_token'],
25+
debug: true
2826
});
27+
app.use(oauth.handler());
28+
app.use(oauth.errorHandler());
29+
2930

3031
app.get('/', function (req, res) {
3132
// outputs datastores to the console

examples/mongodb/Readme.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ For example:
3232
```js
3333
...
3434

35-
app.configure(function() {
36-
var oauth = oauthserver({
37-
model: require('./model'),
38-
grants: ['password'],
39-
debug: true
40-
});
41-
app.use(express.bodyParser());
42-
app.use(oauth.handler());
43-
app.use(oauth.errorHandler());
35+
app.use(bodyParser());
36+
37+
var oauth = oauthserver({
38+
model: require('./model'),
39+
grants: ['password'],
40+
debug: true
4441
});
42+
app.use(oauth.handler());
43+
app.use(oauth.errorHandler());
4544

4645
...
4746
```

examples/postgresql/Readme.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ For example:
99
```js
1010
...
1111

12-
app.configure(function() {
13-
var oauth = oauthserver({
14-
model: require('./model'),
15-
grants: ['password'],
16-
debug: true
17-
});
18-
app.use(express.bodyParser());
19-
app.use(oauth.handler());
20-
app.use(oauth.errorHandler());
12+
app.use(bodyParser());
13+
14+
var oauth = oauthserver({
15+
model: require('./model'),
16+
grants: ['password'],
17+
debug: true
2118
});
19+
app.use(oauth.handler());
20+
app.use(oauth.errorHandler());
2221

2322
...
2423
```

examples/postgresql/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
var express = require('express'),
2+
bodyParser = require('body-parser'),
23
oauthserver = require('../../'); // Would be: 'node-oauth2-server'
34

45
var app = express();
56

6-
app.configure(function() {
7-
app.oauth = oauthserver({
8-
model: require('./model'),
9-
grants: ['auth_code', 'password'],
10-
debug: true
11-
});
12-
app.use(express.bodyParser());
7+
app.use(bodyParser());
8+
9+
app.oauth = oauthserver({
10+
model: require('./model'),
11+
grants: ['auth_code', 'password'],
12+
debug: true
1313
});
1414

1515
// Handle token grant requests

0 commit comments

Comments
 (0)