Merge pull request #494 from BrockAtkinson/hapifix

Update to hapi v17.2.0
This commit is contained in:
Mark Nadal 2018-02-01 23:19:29 -08:00 committed by GitHub
commit 43a14c9528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 838 additions and 284 deletions

View File

@ -1,30 +1,58 @@
console.log("If module not found, install hapi globally `npm i hapi inert -g`!");
console.log("If module not found, install hapi globally `npm i hapi inert -g`!")
const Hapi = require('hapi')
const Inert = require('inert')
const Gun = require('..')
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: '/gun.js',
handler: (request, reply) => reply.file('../gun.js', { confine: false })
})
server.route({
method: 'GET',
path: '/{param*}',
handler: {
directory: {
path: __dirname,
redirectToSlash: true,
index: true
const server = new Hapi.Server({
port: 8080,
host: 'localhost',
routes: {
files: {
relativeTo: require('path').join(__dirname, '..')
}
}
})
server.start()
async function runtime() {
const db = new Gun({
web: server.listener,
file: 'data.json'
})
await server.register(Inert)
server.route({
method: 'GET',
path: '/gun.js',
handler: {
file: 'gun.min.js'
}
})
server.route({
method: 'GET',
path: '/gun/nts.js',
handler: {
file: 'nts.js'
}
})
server.route({
method: 'GET',
path: '/{param*}',
handler: {
directory: {
path: __dirname,
redirectToSlash: true,
index: true
}
}
})
await server.start()
console.log('Server running at:', server.info.uri)
}
runtime()

1046
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -56,8 +56,8 @@
"@trust/webcrypto": "^0.7.1",
"express": ">=4.15.2",
"fake-indexeddb": "^2.0.3",
"hapi": "^16.1.1",
"inert": "^4.2.0",
"hapi": "^17.2.0",
"inert": "^5.1.0",
"ip": "^1.1.5",
"mocha": ">=3.2.0",
"node-localstorage": "^1.3.0",