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

Commit 3112b75

Browse files
Pooya Parsaclarkdo
Pooya Parsa
authored andcommitted
feat(hapi): upgrade to hapi 18 (#231)
1 parent bba70bd commit 3112b75

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

template/_package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"nuxt": "^2.4.0"<% } %><% if (server === 'express') { %>,
2424
"express": "^4.16.4"<% } else if (server === 'koa') { %>,
2525
"koa": "^2.6.2"<% } else if (server === 'hapi') { %>,
26-
"hapi-nuxt": "^1.0.1"<% } else if (server === 'micro') { %>,
26+
"@hapi/hapi": "^18.3.1",
27+
"@nuxtjs/hapi": "^2.2.1"<% } else if (server === 'micro') { %>,
2728
"micro": "^9.3.3",
2829
"micro-route": "^2.5.0"<% } else if (server === 'fastify') { %>,
2930
"fastify": "^1.13.3"<% } else if (server === 'feathers') { %>,
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
const Hapi = require('hapi')
21
const consola = require('consola')
3-
const HapiNuxt = require('hapi-nuxt')
2+
const Hapi = require('@hapi/hapi')
3+
const HapiNuxt = require('@nuxtjs/hapi')
44

5-
const server = new Hapi.Server({
6-
host: process.env.HOST || '127.0.0.1',
7-
port: process.env.PORT || 3000
8-
})
5+
function start() {
6+
const server = new Hapi.Server({
7+
host: process.env.HOST || '127.0.0.1',
8+
port: process.env.PORT || 3000
9+
})
910

10-
server
11-
.register({
12-
plugin: HapiNuxt
11+
await server.register({
12+
plugin: HapiNuxt,
13+
options: {}
1314
})
14-
.then(() => server.start())
15-
.then(() =>
16-
consola.ready({
17-
message: `Server running at: ${server.info.uri}`,
18-
badge: true
19-
})
20-
)
21-
.catch(err => {
22-
consola.error(err)
23-
throw err
15+
16+
await server.start()
17+
18+
consola.ready({
19+
message: `Server running at: ${server.info.uri}`,
20+
badge: true
2421
})
22+
}
23+
24+
process.on('unhandledRejection', error => {
25+
consola.error(error)
26+
})
27+
28+
start()

test/snapshots/index.test.js.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ Generated by [AVA](https://ava.li).
370370
371371
{
372372
dependencies: {
373+
'@hapi/hapi': '^18.3.1',
374+
'@nuxtjs/hapi': '^2.2.1',
373375
'cross-env': '^5.2.0',
374-
'hapi-nuxt': '^1.0.1',
375376
nuxt: '^2.4.0',
376377
},
377378
devDependencies: {

test/snapshots/index.test.js.snap

31 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)