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

feat(hapi): upgrade to hapi 18 #231

Merged
merged 4 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clarkdo Shouldn't the function be async? (I'm having an error at this line on fresh installs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed. waiting for release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@halimb @pi0 v2.8.0 has been released.

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.