I wanted to ask you if it is even possible to create tables dynamically in NodeJS using Sequelize.js. My goal is to create a simple TODO list where users can create a list (this list should be one table in my database). I have successfully established a connection with my database, created some simple models for my users. I want them to add tasks to their lists. I have also created a POST request route in NodeJS where the creation of the table should be done.
I found a code that can create a table (which it does) but I cannot add any items inside the list because the variable is local and I cannot use it anywhere in the code except the POST request in NodeJS. It still feels like static to me..
app.post('/todo/create', async(req: Request, res: Response): Promise <void> => {
....
let Dummy = sequelize.define('dummy', {
description: Sequelize.STRING
});
....
}
For example, if I want to use it like I use my user model down below in login POST request
const existsUser = await User.findOne({where: {username: user}});
Any help or good direction would be much appreciated.