Connecting PostgreSQL database to node REST API using knex

I have been trying to connect my PostgreSQL database to my node REST API using knex, but I keep on getting status code 400 error when i try registering on my frontend. please what can I do to connect it. This is my knex connection
const db = knex({
client: ‘pg’,
connection: process.env.DATABASE_URL
});
My DATABASE_URL is my internal database url on render.
Please, I need someone to help me out.

I am not sure I understand “but I keep on getting status code 400 error when i try registering on my frontend”

What are you regestering on your frontend?

400 error is a bad request meaning the frontend is sending a wrong request to the backend, is there maybe any authentication that the backend needs?

Hi there,

Thanks for reaching out.

Please could you share some specific details of the issue you are experiencing that may help us troubleshoot it with you, e.g. any logs/errors/output, specific URLs, service name/ID, reproduction steps, etc. If you don’t want to share these details on the community forum, please feel free to raise a ticket from the “Contact Support” link at the bottom of the Dashboard.

Thanks.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.