如何运行用Hapi Gun server?

How to run Gun server with Hapi?

我关注this tutorial to create Gun server. But I need to do it with Hapi

现在,我收到以下错误:

> node server.js

Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask Whosebug questions tagged with 'gun'!
0.8 WARNING! Breaking changes, test that your app works before upgrading! The adapter interface has been upgraded (non-default storage and transport layers probably won't work). Also, `.path()` and `.not()` are outside core and now in 'lib/'.
WARNING! This `file.js` module for gun is intended for local development testing only!
/home/trex/dev/learn/gun/server/server.js:17
gun.wsp(server);
    ^

TypeError: gun.wsp is not a function
    at Object.<anonymous> (/home/trex/dev/learn/gun/server/server.js:17:5)

服务器源代码:

const Hapi = require('hapi');
const Gun = require('gun');

const gun = new Gun();
const server = new Hapi.Server();

server.connection({ port: 3000, host: 'localhost' });

server.ext('onRequest', () => gun.wsp.server);

gun.wsp(server);

server.start((err) => {

    if (err) {
        throw err;
    }
    console.log(`Server running at: ${server.info.uri}`);
});

这里有什么问题?

gun 0.8.8 https://github.com/amark/gun/pull/423

中解决的错误
const Hapi  = require('hapi');
const Inert = require('inert');
const Gun   = require('../gun/');

const server = new Hapi.Server;
server.connection({ port: 8080 });
server.connections.forEach(c => Gun({ web: c.listener, file: 'data.json' }));

server.register(Inert, () => {});

server.route({
  method: 'GET',
  path: '/{param*}',
  handler: {
    directory: {
      path: __dirname,
      redirectToSlash: true,
      index: true
    }
  }
});

server.start();