Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit

Permalink
feat(hapi): upgrade to hapi 18 (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa authored and clarkdo committed May 13, 2019
1 parent bba70bd commit 3112b75
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
3 changes: 2 additions & 1 deletion template/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"nuxt": "^2.4.0"<% } %><% if (server === 'express') { %>,
"express": "^4.16.4"<% } else if (server === 'koa') { %>,
"koa": "^2.6.2"<% } else if (server === 'hapi') { %>,
"hapi-nuxt": "^1.0.1"<% } else if (server === 'micro') { %>,
"@hapi/hapi": "^18.3.1",
"@nuxtjs/hapi": "^2.2.1"<% } else if (server === 'micro') { %>,
"micro": "^9.3.3",
"micro-route": "^2.5.0"<% } else if (server === 'fastify') { %>,
"fastify": "^1.13.3"<% } else if (server === 'feathers') { %>,
Expand Down
42 changes: 23 additions & 19 deletions template/frameworks/hapi/server/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
const Hapi = require('hapi')
const consola = require('consola')
const HapiNuxt = require('hapi-nuxt')
const Hapi = require('@hapi/hapi')
const HapiNuxt = require('@nuxtjs/hapi')

const server = new Hapi.Server({
host: process.env.HOST || '127.0.0.1',
port: process.env.PORT || 3000
})
function start() {
const server = new Hapi.Server({
host: process.env.HOST || '127.0.0.1',
port: process.env.PORT || 3000
})

server
.register({
plugin: HapiNuxt
await server.register({
plugin: HapiNuxt,
options: {}
})
.then(() => server.start())
.then(() =>
consola.ready({
message: `Server running at: ${server.info.uri}`,
badge: true
})
)
.catch(err => {
consola.error(err)
throw err

await server.start()

consola.ready({
message: `Server running at: ${server.info.uri}`,
badge: true
})
}

process.on('unhandledRejection', error => {
consola.error(error)
})

start()
3 changes: 2 additions & 1 deletion test/snapshots/index.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,9 @@ Generated by [AVA](https://ava.li).
{
dependencies: {
'@hapi/hapi': '^18.3.1',
'@nuxtjs/hapi': '^2.2.1',
'cross-env': '^5.2.0',
'hapi-nuxt': '^1.0.1',
nuxt: '^2.4.0',
},
devDependencies: {
Expand Down
Binary file modified test/snapshots/index.test.js.snap
Binary file not shown.

0 comments on commit 3112b75

Please sign in to comment.