Database connection
Hey I have a mysql database, I can connect to it and run CRUD actions.
But I feel like the setup is wrong.
I have this function:
and I call the db for running queries.
But that means I create a connection on any query, what would be the correct way to connection the bot on startup and have a live connection?
9 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPthis doesn't have to do with djs at all, #other-js-ts
There isn't a best practice for doing that on discord.js?
djs is simply a library to interact with the discord api
it has nothing to do with databases
how you manage your databases, or whether you have one at all is entirely up to your needs and preferences
you right, got that!
there are best practices for managing databases in general though, but that falls outside the scope of djs
Mind pointing me in the right direction before I close the ticket?
it's better to discuss further in the other channel
basically just move your question there
Thank you!