This is a two parts Please leave comments in the code where you make the changes
ID: 3750351 • Letter: T
Question
This is a two parts Please leave comments in the code where you make the changes so I learn. and Please help me answer the question below
Part One: A Simple hello web site
________________________________________________________________________
Project Description:
You are given a Wake Tech Credit Union web site made by Node.js. It’s a fake bank your instructor made and is actually hosted at http://wtcu.herokuapp.com/. It has the loan calculator we did in Unit 02 Lab and Google Web Speech customer form we did in Unit 03 Lab. You can play around.
The instructor should provide you the source code in unit06_lab.zipfile in BlackBoard Unit 06 Lab sections. There are many files and folders in this project seen below:
Extract this zipped file to your computer and run it from a Windows command window or MacOS terminal window using the node command like below:
Now you have a locally deployed Wake Tech Credit Union web site at http://localhost:3333/. Use a browser and open it and you should see something like this:
Go to the FEEDBACK page and record some customer feedback text like below:
After you have sent the feedback, you should see the log in the console like below.
You can stop this program by pressing + C.
Your job is to use NPM to download a free module called “colors” described in our textbook. Modify app.js file so that the customer’s feedback text will be shown as green in the black console.
App.js file
________________________________________________________________
Part Two: Short answer questions
*All questions are based on the project source code provided by the instructor.
Question 1: Inside app.js there are two require()function calls. What type of modules are these? Are they third-party modules, Node.js built-in modules, or programmer defined modules? (They can be two different types. Answer for each separately if that’s the case.
Question 2: Based on the package.jsonfile in this project, answer the following question: What is the entry point to this program?
What third-party module(s) does this project depend on?
What version is current project?
Question 3: What do you have to do if you decided to remove the “colors” module after you have installed it? What command do you need to run?
Explanation / Answer
ANSWER:
Q. Inside app.js there are two require() function calls.
What type of modules are these?
Are they third-party modules, Node.js built-in modules, or programmer defined modules? (They can be two different types. Answer for each separately if that’s the case.)
Answer:
var express = require('express');
This is express, basically the starting point of every node application, providing different server side functionalities of routing, restful services and middleware etc. This is a 3rd-party module in the node.
var fs = require('fs');
This refers to in-built module for manipulating file systems in node application. Generally, this module is used for manipulation of file names, path, read/write actions etc.
var colors = require('colors');
Colors is another 3rd-paty module in npm (node package manager), which gives ability to modify colors in the console log, normally texts are white on black screen of console. But using this we can use different foreground and background colors like red, green, magenta etc as well. Not only colors but styling can be changed using this module.
Q. What is the entry point to this program?
In the provided package.json file each binary pair of strings[“name”:”wtcu”] acts as key value pair. In this “main”:”app.js”, describes the starting point of application, here the value part-app.js is the entry point of our application.
Q. What third-party module(s) does this project depend on?
“dependencies”:{“colors”:”^1.21.2”,…….} this describes the external modules used by the current application, which must be present before hand in order to app to run successfully. Here dependencies are Express and colors.
Q. What version is current project?
Current app version is 1.0.0[“version”:”1.0.0”]
Q. What do you have to do if you decided to remove the “colors” module after you have installed it? What command do you need to run?
In order to remove any installed module we can run the uninstall command from the npm console. While installing if you had used the --save command then an entry would have been created in the package.json file, like we saw in previous qs. Once you run the uninstall command the entry of that module would be removed from the package.json file and its folder would be removed from the node_modules folder.
Command- npm uninstall colors -save
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.