initServer(server: Server)
where Server
is imported from @hapi/hapi.Server
. When I pass to this function a variable named server: Hapi.Server = new Hapi.Server()
where Hapi
is imported from @types/hapi
, the compiler yields the error Property 'token' is missing in type 'import("/home/foo/bar/myproject/node_modules/@types/hapi/index").AuthCredentials' but required in type 'import("/home/foo/bar/myproject/node_modules/@types/hapi__hapi/index").AuthCredentials'
. Why are the two types different? How can I solve this problem? Thanks :)
@types/hapi
is for package the package hapi
, and the official package moved to @hapi/hapi
this year, and you need to use @types/hapi__hapi
await server.register([
{ plugin: require('./routes/surveys') },
{ plugin: require('./routes/companies') },
{
plugin: yar,
options: {
cookieOptions: {
password: 'the-password-must-be-at-least-32-characters-long',
isSecure: true
}
}
},
Vision
]);
Using it like this
static inviteUserShowForm(request, h) {
request.yar.set('success', 'Invitation send successfully.');
return h.view('invite-user');
}
Joi
for data validation with an other validation package let say for example https://github.com/epoberezkin/ajv
request.response.source
now I need to access with request.response.source.payload
. I'm having difficulty identifying when and where that change was introduced. Could someone provide some insight. Thank you.