internet fundamentals and scripting subject Write steps for creating following program.  1. How we create an npm project and mention the package needed to install express.js globally. 2. Now write code to create an express.js app which funnels the requests through 2 middleware functions that log something to the console and return one response. 3. Handle the requests to "/" and "/shop" and “/users” such that each request only has one handler /middleware that does something with it

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

internet fundamentals and scripting subject

Write steps for creating following program. 
1. How we create an npm project and mention the package needed to install express.js globally.
2. Now write code to create an express.js app which funnels the requests through 2 middleware functions that log something to the console and return one response.
3. Handle the requests to "/" and "/shop" and “/users” such that each request only
has one handler /middleware that does something with it

Expert Solution
Step 1

1.

Create a directory to contain your application and make it your working directory, assuming you've previously installed Node.js.

$mkdir myapp

$cd myapp

Create a package.json file for your application with the npm init command. See Specifics of npm's package.json handling for additional information on how package.json works.

$ npm init

This command will ask you for information such as your application's name and version. With the exception of the following, you may just hit RETURN to accept the defaults for the time being:

entry point: (index.js)

Enter app.js, or whatever name you choose for the main file. If index.js is what you want, press RETURN to accept the proposed default file name.

Now, under the myapp directory, install Express and save it in the requirements list. Consider the following scenario:

$ npm install express --save

To temporarily install Express without adding it to the requirements list, follow these steps:

$ npm install express --no-save

 

steps

Step by step

Solved in 3 steps with 10 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY