From 925b2cf86facb2d4d93648eb5c6f3ae741d8df26 Mon Sep 17 00:00:00 2001 From: Peter Marton Date: Tue, 12 Sep 2017 18:06:59 +0200 Subject: [PATCH] chore(examples): migrate spdy, dtrace and jsonp examples to the latest restify (#1488) --- examples/dtrace/hello.js | 13 ++++++------- examples/jsonp/jsonp.js | 4 ++-- examples/spdy/spdy.js | 8 +++++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/dtrace/hello.js b/examples/dtrace/hello.js index 039150207..ae9de264e 100644 --- a/examples/dtrace/hello.js +++ b/examples/dtrace/hello.js @@ -1,14 +1,14 @@ -var restify = require('../lib'); +var restify = require('../../lib'); var server = restify.createServer({ name: 'helloworld' }); -server.use(restify.acceptParser(server.acceptable)); -server.use(restify.authorizationParser()); -server.use(restify.dateParser()); -server.use(restify.queryParser()); -server.use(restify.urlEncodedBodyParser()); +server.use(restify.plugins.acceptParser(server.acceptable)); +server.use(restify.plugins.authorizationParser()); +server.use(restify.plugins.dateParser()); +server.use(restify.plugins.queryParser()); +server.use(restify.plugins.urlEncodedBodyParser()); server.use(function slowHandler(req, res, next) { setTimeout(function () { @@ -29,4 +29,3 @@ server.get({ server.listen(8080, function () { console.log('listening: %s', server.url); }); - diff --git a/examples/jsonp/jsonp.js b/examples/jsonp/jsonp.js index 8de1ccb2d..c57ea23d9 100644 --- a/examples/jsonp/jsonp.js +++ b/examples/jsonp/jsonp.js @@ -1,8 +1,8 @@ var restify = require('../../lib'); var srv = restify.createServer(); -srv.use(restify.queryParser()); -srv.use(restify.jsonp()); +srv.use(restify.plugins.queryParser()); +srv.use(restify.plugins.jsonp()); srv.get('/', function (req, res, next) { res.send({hello: 'world'}); next(); diff --git a/examples/spdy/spdy.js b/examples/spdy/spdy.js index 72007e596..e0ab72041 100644 --- a/examples/spdy/spdy.js +++ b/examples/spdy/spdy.js @@ -1,12 +1,13 @@ +var path = require('path'); var fs = require('fs'); var bunyan = require('bunyan'); var restify = require('../../lib'); var srv = restify.createServer({ spdy: { - cert: fs.readFileSync('./keys/spdy-cert.pem'), - key: fs.readFileSync('./keys/spdy-key.pem'), - ca: fs.readFileSync('keys/spdy-csr.pem') + cert: fs.readFileSync(path.join(__dirname, './keys/spdy-cert.pem')), + key: fs.readFileSync(path.join(__dirname, './keys/spdy-key.pem')), + ca: fs.readFileSync(path.join(__dirname, 'keys/spdy-csr.pem')) } }); @@ -16,6 +17,7 @@ srv.get('/', function (req, res, next) { }); srv.on('after', restify.plugins.auditLogger({ + event: 'after', body: true, log: bunyan.createLogger({ name: 'audit',