Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: First Node App | Introduction
Node.js Express: API & CLI Apps
course content

Course Content

Node.js Express: API & CLI Apps

Node.js Express: API & CLI Apps

1. Introduction
2. Console Applications
3. Express.js Framework
4. Developing REST API

bookChallenge: First Node App

🏆 Challenge

🎯 Goal

Prepare to begin a coding challenge to test your newfound knowledge of creating a simple Node.js application. The goal is to solidify your understanding of building a basic application using a single file and running it locally on the machine. This experience is crucial for your journey, as you'll frequently work locally in your development environment.

📋 Task

Create the Node.js application that calculates the total amount of money a user should pay for a given order. Here are the steps to complete the task:

  1. Start by opening a new project directory where you'll create a file named app.js.
  2. Inside the app.js file, set three predefined variables:
    • ordererQuantity: The number of tumblers the user ordered;
    • pricePerTumbler: The price of a single tumbler;
    • message: The message to be logged in the console.
  3. Your main task is to calculate the total amount of money the user must pay for the order.
  4. Once you've calculated the total cost, use the console.log() function to display the message and the estimated total amount.
  5. After writing the code, open your terminal and run the application.
  6. You should see the result in the console, displaying the total amount the user needs to pay.
12345
// app.js const ordererQuantity = 4; const pricePerTumbler = 49; const message = "You have to pay:"; console.log(message, ___);
copy
1. What is the price a user should pay?
2. What command must we use to run the `app.js` file in the terminal?
What is the price a user should pay?

What is the price a user should pay?

Select the correct answer

What command must we use to run the `app.js` file in the terminal?

What command must we use to run the app.js file in the terminal?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 6
some-alt