Node.js+express makes web calculator
Environment:
Host: WIN10
express installation:
1. Install express-generator
Enter the command:
1 |
|
2. Install express
Enter the command:
1 |
|
3 .Verify whether the installation is successful
Enter the command: express -V
View help: express --help
Create the project:
1 2 |
|
Run the default web page:
Enter the command: npm start or node ./bin/www
The port is configured in /bin/www.
Can perform addition operations.
Source code:
view/index.ejs: Add input box
routes/index.js: Calculate and push the submitted data Result
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
[Related tutorial recommendations]
1. JavaScript video tutorial
2. JavaScript online manual
3. bootstrap tutorial

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The ac key on the calculator is the "all clear" key. The full English name of ac is "All Clear", which means "all clear key"; pressing the ac key means clearing the values in all registers; during number input, the first press Pressing the ac key will clear all values except the memory contents.

The Node service built based on non-blocking and event-driven has the advantage of low memory consumption and is very suitable for handling massive network requests. Under the premise of massive requests, issues related to "memory control" need to be considered. 1. V8’s garbage collection mechanism and memory limitations Js is controlled by the garbage collection machine

This article will give you an in-depth understanding of the memory and garbage collector (GC) of the NodeJS V8 engine. I hope it will be helpful to you!

The win10 system has many powerful functions, which attract many netizens to download, install and use it. There are also many practical gadgets, such as the win10 calculator tool. Some netizens still don’t know how to open the Win10 calculator. Let me teach you how to open the Win10 calculator. Method 1: Search in the Start menu 1. On the Windows 10 system desktop, click the "Start/Calculator" menu item. 2. You can open the calculator window of Windows 10. Method 2: Open Cortana Search 1. On the Windows 10 desktop, click the "Cortana Search" icon in the lower left corner of the taskbar. 2. Enter the keyword "calculator" in the pop-up menu to search, and click the calculator menu item in the search results.

How to handle file upload? The following article will introduce to you how to use express to handle file uploads in the node project. I hope it will be helpful to you!

The file module is an encapsulation of underlying file operations, such as file reading/writing/opening/closing/delete adding, etc. The biggest feature of the file module is that all methods provide two versions of **synchronous** and **asynchronous**, with Methods with the sync suffix are all synchronization methods, and those without are all heterogeneous methods.

The reason why node cannot use the npm command is because the environment variables are not configured correctly. The solution is: 1. Open "System Properties"; 2. Find "Environment Variables" -> "System Variables", and then edit the environment variables; 3. Find the location of nodejs folder; 4. Click "OK".

The event loop is a fundamental part of Node.js and enables asynchronous programming by ensuring that the main thread is not blocked. Understanding the event loop is crucial to building efficient applications. The following article will give you an in-depth understanding of the event loop in Node. I hope it will be helpful to you!
