![]() Now, in the server folder we will create an index.js file where we will define all our backend logic, i.e., the endpoints/routes to get, update, and delete queries: const express = require('express') ĭb.query("SELECT * FROM posts", (err,result)=>`) Server -> config -> db.js: const mysql = require('mysql') Now we’ll create a config folder inside server folder and a db.js file inside it so that we can define our db configurations: So, if you’ve named your parent folder “blog”, then the folder structure should look like this: Next, we will create two folders in our main app folder, one is a server(having the backend structure) and one is the client (containing the front end files). ![]() I will add the following six columns in the ‘posts’ table in my DB: I will go to my browser and write localhost/phpmyadmin to open up the database console and create a new database (since I am creating a blog posts webpage where you can create, list, delete, and add a blog post I will name the db–> blog_posts). So, I have got the XAMMP server installed on the system for MySQL DB to host upon. The steps above are a high-level description of what we are trying to achieve, we may jump from one step to another, but eventually, we will reach the goal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |