0
Good evening, I am trying to implement Swagger in my api however it is presented the following error in my console
(node:28024) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: Plugin hapi-swagger missing dependency @hapi/inert
(node:20248) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:20248) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
my code is very simple
//importo os modulos
const HapiSwagger = require('hapi-swagger')
const Vision = require('vision')
const Inert = require('inert')
//crio meu plugin custom
const Swagger = {
info:{
title:'Api Herois - #NodeBr',
version: 'v1.0'
}
}
//tento realizar o registro
await app.register([
Vision,
Inert,
{
plugin: HapiSwagger,
options:Swagger
}
])
if necessary I put the whole code
– Willian Carlos