


Node.js: Node.js service built under Windows 7 (let's play with server-side javascript, this is not a front-end js plug-in)_javascript skills
这里只是纯粹的搭建,连环境都没有,还玩什么服务器端js,一切都成了浮云,让我们先搭建一个环境,输入一个“hello world”的页面。
对的,windows7下的搭建,你只需一步一步跟着我做,就ok了,不用去了解过多的细节,那不是我们现在要关心的,我们现在首要目的是把环境搭建好,要不然就没有下一步了。
Step 1. 下载node.js在windows下是要安装在Cygwin下的,去Cygwin网站下载Cygwin安装程序。
Cygwin网站:http://cygwin.com/
直接下载地址:http://cygwin.com/setup.exe
Step 2. 安装
安装你下下来的Cygwin程序,基本上只需下一步就可以。
在Choose A Download Source界面选择-》install from internet
在Select Your Internet Connection界面选择-》Direct Connect
在Choose A Download Site界面选择-》这个自己选择了,就是选择下载的镜像,推荐使用.jp结尾的日本网站,速度比较快
注意:如果你是首次安装,可能会弹出警告提示,不管管他,点击ok就可以。
Step 3. 选择安装组件
注意:由于组件较多,建议使用搜索的方式来查找。点击名字即可选中,选中后后面会有一个小方块,里面有X(叉)表示选中。
Devel 分类
gcc-g++: C++ compiler
gcc-mingw-g++: Mingw32 support headers and libraries for GCC C++
gcc4-g++: G++ subpackage
git: Fast Version Control System – core files
make: The GNU version of the 'make' utility
openssl-devel: The OpenSSL development environment
pkg-config: A utility used to retrieve information about installed libraries
zlib-devel: The zlib compression/decompression library (development)
Editor 分类
vim: Vi IMproved - enhanced vi editor
Python 分类
全部
注意:全部安裝,你只要点选 Python 右边的图标切换至 Install 即可。
Web 分类
wget: Utility to retrieve files from the WWW via HTTP and FTP
curl: Multi-protocol file transfer command-line tool
下一步之后会提示你有许多相依的组件需要安装,基本上直接按下一步即可。
注意:由于组件都是在线下载,可能有点漫长,等待即可。
Step 4. 运行ash.exe
安装完后会在桌面生成图标(如果你选了在桌面生成图标项的话),注意不是运行这个图标!
打开文件夹,进入C:cygwinbin 目录中,这个是默认的安装目录,如果你修改过安装目录,自己进入到cygwin的安装目录下的bin目录中。
运行ash.exe
在弹出的命令窗口中执行 ./rebaseall -v 命令
等命令执行完成执行 exit 退出 ash
Step 5. 下载并安装Node.js
运行桌面上的Cygwin程序。
在命令窗口中输入 wget http://nodejs.org/dist/node-v0.4.7.tar.gz 回车。
注意:我在写这篇文章是node.js的最新版本是node-v0.4.7, http://nodejs.org/dist/node-v0.4.7.tar.gz 是node.js的下载地址,你在看这篇文章时可以自己去node.js的网站获取最新的下载路径替换就可以了
Node.js网站:http://nodejs.org/
在命令窗口中输入 tar xf node-v0.4.7.tar.gz 回车,node-v0.4.7.tar.gz为你自己下载的版本。
在命令窗口中输入 cd node-v0.4.7 回车。
在命令窗口中输入 ./configure 回车。
在命令窗口中输入 make 回车。
在命令窗口中输入 make install 回车。
ok,到这里你已经安装完成node.js了
在命令窗口中输入 node --version 回车,看看你的node.js版本。
Step 6. 设置DNS
打开文件夹,进入到C:cygwinetc 文件夹下。
手动建立 resolv.conf 文件。
用记事本打开刚建立的resolv.conf文件,添加如下
nameserver 8.8.8.8
nameserver 8.8.4.4
保存并关闭。
Step End. 测试Node.js是否可以运行
到此你就已经搭建完成了,但是不知道是否可以正确运行,那么,下面让我们来写个示例文件来测试下。
在C:cygwin 目录下建立 example.js
输入
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('Hello World');
}).listen(8888);
console.log('Server running at http://127.0.0.1:8888/');
Save (note: save in UTF-8 format, otherwise a syntax error will be reported).
Run cygwin, enter node /example.js in the command window and press Enter
Have you seen Server running at http://127.0.0.1:8888/
Don’t close cygwin, open the browser, visit http://127.0.0.1:8888/ and see if the hello world page appears.

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

Python is more suitable for data science and machine learning, while JavaScript is more suitable for front-end and full-stack development. 1. Python is known for its concise syntax and rich library ecosystem, and is suitable for data analysis and web development. 2. JavaScript is the core of front-end development. Node.js supports server-side programming and is suitable for full-stack development.

JavaScript does not require installation because it is already built into modern browsers. You just need a text editor and a browser to get started. 1) In the browser environment, run it by embedding the HTML file through tags. 2) In the Node.js environment, after downloading and installing Node.js, run the JavaScript file through the command line.

How to send task notifications in Quartz In advance When using the Quartz timer to schedule a task, the execution time of the task is set by the cron expression. Now...

How to obtain the parameters of functions on prototype chains in JavaScript In JavaScript programming, understanding and manipulating function parameters on prototype chains is a common and important task...

Analysis of the reason why the dynamic style displacement failure of using Vue.js in the WeChat applet web-view is using Vue.js...


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

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment