From 1f50f08cc62b86be23a04390a5dec368fddc1444 Mon Sep 17 00:00:00 2001 From: Brendon Colby Date: Sat, 28 Jul 2018 15:36:26 -0400 Subject: [PATCH 1/3] Fixed examples in readme files --- examples/memory/Readme.md | 22 +++++++++++++++++++--- examples/mongodb/Readme.md | 19 ++++++++++++++++++- examples/postgresql/Readme.md | 21 +++++++++++++++++++-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/examples/memory/Readme.md b/examples/memory/Readme.md index b90154d..913bc58 100644 --- a/examples/memory/Readme.md +++ b/examples/memory/Readme.md @@ -7,11 +7,27 @@ The object exposed in model.js could be directly passed into the model parameter For example: ```js -var memorystore = require('model.js'); +var bodyParser = require('body-parser'); +var express = require('express'); +var OAuthServer = require('express-oauth-server'); -app.oauth = oauthserver({ - model: memorystore +var app = express(); + +app.oauth = new OAuthServer({ + debug: true, + // See https://github.com/oauthjs/node-oauth2-server for specification + model: require('./model') }); + +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: false })); +app.use(app.oauth.authorize()); + +app.use(function(req, res) { + res.send('Secret area'); +}); + +app.listen(3000); ``` # Dump diff --git a/examples/mongodb/Readme.md b/examples/mongodb/Readme.md index e532fca..48cf862 100755 --- a/examples/mongodb/Readme.md +++ b/examples/mongodb/Readme.md @@ -25,8 +25,25 @@ The object exposed in model.js could be directly passed into the model parameter For example: ```js -app.oauth = oauthserver({ +var bodyParser = require('body-parser'); +var express = require('express'); +var OAuthServer = require('express-oauth-server'); + +var app = express(); + +app.oauth = new OAuthServer({ debug: true, + // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); + +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: false })); +app.use(app.oauth.authorize()); + +app.use(function(req, res) { + res.send('Secret area'); +}); + +app.listen(3000); ``` diff --git a/examples/postgresql/Readme.md b/examples/postgresql/Readme.md index 962dd16..fb85ead 100644 --- a/examples/postgresql/Readme.md +++ b/examples/postgresql/Readme.md @@ -7,10 +7,27 @@ See schema.sql for the tables referred to in this example. For example: ```js -var oauth = oauthserver({ - debug: true, +var bodyParser = require('body-parser'); +var express = require('express'); +var OAuthServer = require('express-oauth-server'); + +var app = express(); + +app.oauth = new OAuthServer({ + debug: true, + // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); + +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ extended: false })); +app.use(app.oauth.authorize()); + +app.use(function(req, res) { + res.send('Secret area'); +}); + +app.listen(3000); ``` ## Note From 6bf45f4238af3c9371be2ced57a1d0661698b50c Mon Sep 17 00:00:00 2001 From: Brendon Colby Date: Sat, 28 Jul 2018 15:38:00 -0400 Subject: [PATCH 2/3] Removed tabs --- examples/memory/Readme.md | 4 ++-- examples/postgresql/Readme.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/memory/Readme.md b/examples/memory/Readme.md index 913bc58..d803ace 100644 --- a/examples/memory/Readme.md +++ b/examples/memory/Readme.md @@ -14,8 +14,8 @@ var OAuthServer = require('express-oauth-server'); var app = express(); app.oauth = new OAuthServer({ - debug: true, - // See https://github.com/oauthjs/node-oauth2-server for specification + debug: true, + // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); diff --git a/examples/postgresql/Readme.md b/examples/postgresql/Readme.md index fb85ead..189bb10 100644 --- a/examples/postgresql/Readme.md +++ b/examples/postgresql/Readme.md @@ -14,8 +14,8 @@ var OAuthServer = require('express-oauth-server'); var app = express(); app.oauth = new OAuthServer({ - debug: true, - // See https://github.com/oauthjs/node-oauth2-server for specification + debug: true, + // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); From 533a9d037cffdf6e5624b36f74e325a1365ebbf9 Mon Sep 17 00:00:00 2001 From: Brendon Colby Date: Sat, 28 Jul 2018 15:40:51 -0400 Subject: [PATCH 3/3] Removed unnecessary lines from example readmes --- examples/memory/Readme.md | 11 ----------- examples/mongodb/Readme.md | 11 ----------- examples/postgresql/Readme.md | 11 ----------- 3 files changed, 33 deletions(-) diff --git a/examples/memory/Readme.md b/examples/memory/Readme.md index d803ace..ee95077 100644 --- a/examples/memory/Readme.md +++ b/examples/memory/Readme.md @@ -7,7 +7,6 @@ The object exposed in model.js could be directly passed into the model parameter For example: ```js -var bodyParser = require('body-parser'); var express = require('express'); var OAuthServer = require('express-oauth-server'); @@ -18,16 +17,6 @@ app.oauth = new OAuthServer({ // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); - -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); -app.use(app.oauth.authorize()); - -app.use(function(req, res) { - res.send('Secret area'); -}); - -app.listen(3000); ``` # Dump diff --git a/examples/mongodb/Readme.md b/examples/mongodb/Readme.md index 48cf862..b902add 100755 --- a/examples/mongodb/Readme.md +++ b/examples/mongodb/Readme.md @@ -25,7 +25,6 @@ The object exposed in model.js could be directly passed into the model parameter For example: ```js -var bodyParser = require('body-parser'); var express = require('express'); var OAuthServer = require('express-oauth-server'); @@ -36,14 +35,4 @@ app.oauth = new OAuthServer({ // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); - -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); -app.use(app.oauth.authorize()); - -app.use(function(req, res) { - res.send('Secret area'); -}); - -app.listen(3000); ``` diff --git a/examples/postgresql/Readme.md b/examples/postgresql/Readme.md index 189bb10..65f4170 100644 --- a/examples/postgresql/Readme.md +++ b/examples/postgresql/Readme.md @@ -7,7 +7,6 @@ See schema.sql for the tables referred to in this example. For example: ```js -var bodyParser = require('body-parser'); var express = require('express'); var OAuthServer = require('express-oauth-server'); @@ -18,16 +17,6 @@ app.oauth = new OAuthServer({ // See https://github.com/oauthjs/node-oauth2-server for specification model: require('./model') }); - -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); -app.use(app.oauth.authorize()); - -app.use(function(req, res) { - res.send('Secret area'); -}); - -app.listen(3000); ``` ## Note