Question: Part 1 has been completed. Create a SQL database for a social media purpose, including at least four tables. I used MySQL for this Design

Part 1 has been completed.

Create a SQL database for a social media purpose, including at least four tables. I used MySQL for this Design a table for the users information 10% Design a table for users contacts 10% Design a table for users messages 10% Design a table for users likes 10% Fill the tables with arbitrary data 10% * Each table must include a primary key.

Part 2 is what I need help with:

1. Write a NodeJS program that connects to your database 10% 2. Create an HTTP server using Nodejs 10% 3. Define different URL routes to display each table content on the browser. 30%

For example, http://localhost: 3000/user shows the data of the user table

This is what I have so far, any help would be greatly appreciated.

const mysql = require('mysql'); const http = require('http');

//Create a connection to MySQL Database

let connection = mysql.createConnection({ host: 'localhost', user: 'root', password: '', database: '' });

//Connect connection.connect(function(err) { if (err) { return console.error('error: ' + err.message); } console.log('Connected to the MySQL server.'); });

// create web server http.createServer(function (httpRequest, httpResponse) {

}).listen(8080);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!