Creating table from js file

i have written the same code but my code is showing no such table exist ie mytestdb.persons does not exist

@royprincejmp have you installed mysql on your system, start the service and check again. Share the project code too (upload it on github and share it here)

yes i have installed the previous code has run also i don’t know to upload code on github .is there an alternate way?

@royprincejmp first check by logging into your mysql, see if the table is present there or not. Send some screenshots of your project files too.

no table is not created there but it should be created from code only na ?where to send screenshot?

@royprincejmp upload them on drive, and send the link here, have you written the code for creating tables too?
Anyway, send the screenshots and then we can look into it more closely.

https://drive.google.com/drive/folders/1OQYZ4EQ-i6lCI5Oj4vea61ifoiq5J8wx?usp=sharing

it is the link of entire code

@royprincejmp table is not present, bcoz there is no code for table creation in your project files, from here you can do two things:

  • first one is to create the table manually in your mysql by running raw query
  • second is to use sequelize and write code for table creation in your project
    I believe first one would be easier, as you have complete code written, just create the table in the database (whichever one you have created and used in your project). After that you will be able to run your project without any error.

thans now my localhost:4444 is working but localhost:4444/pages is not working it shows an error Error: Failed to lookup view “persons” in views directory “e:\web development\webinar 12\mysql_express_serveriews”

@royprincejmp bring your app.use middleware (this one app.use(’/’, express.static(path.join(__dirname, ‘public_static’)))) above your app.get methods, and then it will work

yeah it worked thanks a lot .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.