Fix examples
This commit is contained in:
parent
f6f0e92e43
commit
d39b01afa2
|
@ -1,5 +1,5 @@
|
|||
var request = require('request');
|
||||
var bitauth = require('../lib/bitauth');
|
||||
var bitauth = require('..'); // or require('bitauth');
|
||||
|
||||
// These can be generated with bitauth.generateSin()
|
||||
var keys = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var express = require('express');
|
||||
var bodyParser = require('body-parser');
|
||||
var rawBody = require('../lib/middleware/rawbody');
|
||||
var bitauth = require('../lib/middleware/bitauth');
|
||||
var bitauthMiddleware = require('../lib/middleware/bitauth');
|
||||
|
||||
var users = {
|
||||
'Tf7UNQnxB8SccfoyZScQmb34V2GdEtQkzDz': {name: 'Alice'},
|
||||
|
@ -15,12 +15,12 @@ app.use(rawBody);
|
|||
app.use(bodyParser());
|
||||
|
||||
|
||||
app.get('/user', bitauth, function(req, res) {
|
||||
app.get('/user', bitauthMiddleware, function(req, res) {
|
||||
if(!req.sin || !users[req.sin]) return res.send(401, {error: 'Unauthorized'});
|
||||
res.send(200, users[req.sin]);
|
||||
});
|
||||
|
||||
app.post('/pizzas', bitauth, function(req, res) {
|
||||
app.post('/pizzas', bitauthMiddleware, function(req, res) {
|
||||
if(!req.sin || !users[req.sin]) return res.send(401, {error: 'Unauthorized'});
|
||||
var pizza = req.body;
|
||||
pizza.owner = users[req.sin].name;
|
||||
|
|
11
package.json
11
package.json
|
@ -36,20 +36,23 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"benchmark": "^1.0.0",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"body-parser": "^1.14.1",
|
||||
"browserify": "~11.2.0",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"chai": "=1.9.1",
|
||||
"express": "^4.13.3",
|
||||
"gulp": "^3.8.10",
|
||||
"gulp-bump": "^0.1.11",
|
||||
"gulp-mocha": "^2.0.0",
|
||||
"gulp-git": "^0.5.5",
|
||||
"gulp-mocha": "^2.0.0",
|
||||
"gulp-shell": "^0.2.10",
|
||||
"karma": "^0.13.9",
|
||||
"karma-firefox-launcher": "^0.1.4",
|
||||
"karma-mocha": "^0.1.9",
|
||||
"mocha": "~1.20.1",
|
||||
"request": "^2.65.0",
|
||||
"run-sequence": "^1.0.2",
|
||||
"uglify-js": "~2.4.14",
|
||||
"mocha": "~1.20.1"
|
||||
"uglify-js": "~2.4.14"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue