fastify.post("/license", async (request, reply) => {
const client = await fastify.pg.connect();
const { license_key } = request.body;
try {
const result = await client.query(
"SELECT * FROM license WHERE license_key LIKE $1",
[license_key]
);
console.log(result.rows);
console.log({ license_key });
// Pass the search results to the EJS template
return reply.view("/login.ejs", { license_users: result.rows });
} catch (err) {
console.error(err);
return reply.view("error.ejs");
} finally {
client.release();
}
});
when i write "good" on input form then in terminal window console.log(result.rows);
console.log({ license_key }); result is [ { id: 28, license_key: 'good' } ]
{ license_key: 'good' } but nothing to show in console window only "Error: undefined" occured in browser console window
i think return reply.view("/login.ejs", { license_users: result.rows }); not works. Input data not pass to login.ejs code
maybe like operator not pass to template file.
authors not answered my question. They just closed issue. I don't understand. Why they ignored my request of issue. This is my most important project
Prerequisites
Fastify version
4.24.3
Plugin version
No response
Node.js version
20.3
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
Windows 10
Description
my login.ejs has
and my app.js has post method
when i write "good" on input form then in terminal window console.log(result.rows); console.log({ license_key }); result is [ { id: 28, license_key: 'good' } ] { license_key: 'good' } but nothing to show in console window only "Error: undefined" occured in browser console window i think return reply.view("/login.ejs", { license_users: result.rows }); not works. Input data not pass to login.ejs code
maybe like operator not pass to template file.
authors not answered my question. They just closed issue. I don't understand. Why they ignored my request of issue. This is my most important project
Steps to Reproduce
i uploaded to github and respository is
https://github.com/bashgaa/example_like_operator
Expected Behavior
No response