im having hard time finding good documentation on how to setup ssl
this is what I have
const server = hapi.server({
port: port,
host: configs.APIServer[env].Hostname,
routes: {
cors: {
origin: [configs.APIServer[env].Protocol +
"://" +
configs.WebServer[env].Hostname +
":" +
configs.WebServer[env].Port, configs.WebServer[env].Protocol +
"://" +
configs.WebServer[env].IP +
":" +
configs.WebServer[env].Port
]
}
}
// ,debug: {
// request: env === "production" ? ["error"] : ["error", "debug"]
// }
})
do i just need to add on the bottom:
, {
tls: ssloptions
}
where ssloptions is the certs
-I, --ignore - ignore a list of globals for the leak detection (comma separated), this is an alias of globals property in .labrc file. To ignore symbols, pass the symbol's string representation (e.g. Symbol(special)).
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