I am creating a website and I am currently making a database system with mongodb, which I have almost finished but, since I updated a fastify package, the page only displays of white
My package:
fastify: 4.0.3
path: 0.12.7
@fastify/view: 7.0.0
mongodb: 4.7.0
dotenv: 16.0.1
ejs: 3.1.8
@fastify/static: 6.4.0
@fastify/formbody: 7.0.1
fastify-plugin: 3.0.1
mongoose: 6.4.0
My route code:
fastify.get("/result", async function (request, reply) {
let search = request.query.search;
if (search) {
await dbAnime.find({ aliases: search })
.toArray(async function (err, have) {
if (!err) {
if (have.length > 0) {
reply.view("/pages/result.ejs", { results: have }).then(() => {
console.log("replied")
});
console.log(have);
client.close;
} else {
reply.view("/pages/result.ejs", { results: have });
}
} else {
reply.code(400)
console.error(err);
}
});
};
});
i don’t have any error in console, then i don’t know how to fix it