SQL database and NodeJS
Part 1
Create a SQL database for a social media purpose, including at least four tables.
• 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.
* Integrity constraints, such as must appropriately be defined in tables.
* You are free to use any SQL database
Part 2
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.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

// list of router
const routerMap = {
"/information": "information",
"/message": "message",
"/like": "like",
"/contact": "contact"

// some global variables
const port = 3000;
var http = require("http");
var httpStatus = require("http-status-codes");

/// the application
var app = http.createServer(
(req, res) => {
    res.writeHead(httpStatus.OK, {
      "Content-Type": "text/html"

    // if thje link is legal
    if (routerMap[req.url]) {

      // query the database to get the table in _callback
      query(routerMap[req.url], _callback => {
       res.write("<h1> User's " + routerMap[req.url] + "</h1>");
       res.write(_callback, 'utf-8');

By purchasing this solution you'll be able to access the following files:
part2.js and socialmedia.db.

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats