0
我按照this教程創建Gun服務器。但我需要用Hapi來完成。如何用Hapi運行Gun服務器?
現在,我得到以下錯誤:
> node server.js
Hello wonderful person! :) Thanks for using GUN, feel free to ask for help on https://gitter.im/amark/gun and ask StackOverflow 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}`);
});
這裏有什麼問題?
,你仍然有的NodeJS到同步的NodeJS問題?如果兩臺服務器都訂閱了他們想要同步的數據,它應該可以工作。讓我知道! – marknadal
@marknadal不,我沒有問題,這個bug在'0.8.8槍'中解決了 – trex