Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a Node.js server in Windows system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to build a Node.js server in the Windows system. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Node.js is a platform based on Chrome JavaScript runtime, which is used to build network applications with fast response and easy to expand.

Node.js uses event-driven, non-blocking Istroke O model to make it lightweight and efficient, which is very suitable for running data-intensive real-time applications on distributed devices.

It is a JavaScript running environment, which encapsulates the Google V8 engine. V8 engine executes Javascript very fast and the performance is very good. Node.js optimizes some special use cases and provides an alternative API to make V8 run better in a non-browser environment.

At present, the most concerned and best-maintained node.js website in China is www.cnodejs.org, so I won't tell you too much about node.js here. The following "Suwen House" site will tell you in detail how to build a Node.js server and environment configuration under the Windows system.

Step 1: download the node.js installation file

Official download address: https://nodejs.org/en/download/, see figure:

At present, the latest Windows version of the node-v4.6.0-x64.msi installation package, the following demonstration has been the latest version to do a detailed description, welcome to collect Su Wenjia, this site address: www.yoodb.com, let's start to build a nodejs server

Step 2: install the node.js server

After the download is complete, double-click "node-v4.6.0-x64.msi" to begin the installation of the node.js server, customize the installation to the E:\ work\ dev\ nodejs directory, and open the cmd console with the windows key + R shortcut key and enter the command: node-v to test whether the installation is successful.

The console prints out: v4.6.0, indicating the meaning of the version. The installation is successful and its directory structure is shown in the following figure:

Check whether npm has been installed successfully, the new version of nodejs has integrated npm, do not need to install again, similar to the above command, windows key + R shortcut key to open the cmd console input command: windows-v, test whether the installation is successful, the console prints out: 2.15.9, indicating the meaning of the version, the installation is successful.

Step 3: install the relevant environment and execute the following commands

Execute the command npm install express-GMagneCmd console to print as follows:

Express@4.14.0 C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ express

├── escape-html@1.0.3

├── array-flatten@1.1.1

├── utils-merge@1.0.0

├── content-type@1.0.2

├── merge-descriptors@1.0.1

├── methods@1.1.2

├── cookie-signature@1.0.6

├── encodeurl@1.0.1

├── vary@1.1.0

├── path-to-regexp@0.1.7

├── parseurl@1.3.1

├── serve-static@1.11.1

├── etag@1.7.0

├── content-disposition@0.5.1

├── cookie@0.3.1

├── fresh@0.3.0

├── range-parser@1.2.0

├── depd@1.1.0

├── qs@6.2.0

├── debug@2.2.0 (ms@0.7.1)

├── proxy-addr@1.1.2 (forwarded@0.1.0, ipaddr.js@1.1.1)

├── on-finished@2.3.0 (ee-first@1.1.1)

├── finalhandler@0.5.0 (unpipe@1.0.0, statuses@1.3.0)

├── accepts@1.3.3 (negotiator@0.6.1, mime-types@2.1.12)

├── send@0.14.1 (destroy@1.0.4, ms@0.7.1, statuses@1.3.0, mime@1.3.4, http-errors@1.5.0)

└── type-is@1.6.13 (media-typer@0.3.0, mime-types@2.1.12)

Execute the command npm install jade-GMagneCmd console to print as follows:

Npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade

Npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer

C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ jade-> C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ jade\ bin\ jade.js

Jade@1.11.0 C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ jade

├── commander@2.6.0

├── character-parser@1.2.1

├── void-elements@2.0.1

├── mkdirp@0.5.1 (minimist@0.0.8)

├── clean-css@3.4.20 (commander@2.8.1, source-map@0.4.4)

├── constantinople@3.0.2 (acorn@2.7.0)

├── jstransformer@0.0.2 (is-promise@2.1.0, promise@6.1.0)

├── with@4.0.3 (acorn@1.2.2, acorn-globals@1.0.9)

├── transformers@2.1.0 (promise@2.0.0, css@1.0.8, uglify-js@2.2.5)

└── uglify-js@2.7.3 (async@0.2.10, uglify-to-browserify@1.0.2, source-map@0.5.6, yargs@3.10.0)

Execute the command npm install mysql-GMagneCmd console to print as follows:

Mysql@2.11.1 C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ mysql

├── sqlstring@2.0.1

├── bignumber.js@2.3.0

└── readable-stream@1.1.14 (inherits@2.0.3, string_decoder@0.10.31, isarray@0.0.1, core-util-is@1.0.2)

Note:

All commands are installed globally using the-g parameter, which is installed globally in the C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm directory. The advantage of this installation is that it is relatively convenient to access under the current user or anywhere else on the disk.

Step 4: install CoffeeScript

Execute the command npm install coffee-script-GMagneCmd console to print as follows:

C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ cake-> C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ coffee-script\ bin\ cake

C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ coffee- > C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ coffee-script\ bin\ coffee

Coffee-script@1.11.0 C:\ Users\ yoodb.com-PC\ AppData\ Roaming\ npm\ node_modules\ coffee-script

Check whether CoffeeScript is installed successfully. Windows + R shortcut key opens the cmd console and enters the command: coffee-v. The version number CoffeeScript version 1.11.0 indicates that the installation is successful.

Test whether CoffeeScript is working properly (using CoffeeScript syntax and introducing www.yoodb.com search in Suwen House, but not here), and create a new "yoodb.js" file, as follows:

For i in [0..10]

Console.log "# {I} Welcome: www.yoodb.com!"

The execution statement should start with a space in the for loop and cannot be aligned with for, otherwise an error will be reported: unexpected newline, windows + R shortcut key opens the cmd console to enter commands, switch to the corresponding "yoodb.js" file directory, and output the result:

C:\ Users\ yoodb.com-PC > cd e:

E:\

C:\ Users\ yoodb.com-PC > e:

E:\ > cd work\ dev\ projects\

E:\ work\ dev\ projects > coffee yoodb.js

0 Welcome: www.yoodb.com!

1 Welcome: www.yoodb.com!

2 Welcome: www.yoodb.com!

3 Welcome: www.yoodb.com!

4 Welcome: www.yoodb.com!

5 Welcome: www.yoodb.com!

6 Welcome: www.yoodb.com!

7 Welcome: www.yoodb.com!

8 Welcome: www.yoodb.com!

9 Welcome: www.yoodb.com!

10 Welcome: www.yoodb.com!

On how to build a Node.js server in the Windows system to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report