Node.js provides a rich JavaScript library for various Linux modules, which simplifies the use of Node.js, a great convenience for web applications. Research and development. This article will introduce one of the most basic knowledge of Node.js, which is to run Hello world in Ubuntu. After
installed node.js, any path in the new file helloworld.js, enter the following:
console.log (! & Ldquo; Hello world & rdquo;)
Then start Terminal in the path (Command Line Command Line in Windows), or start Terminal and then use cd command to switch to the path (Windows equivalent), then enter the command
node Helloworld.js
Enter, the window will output “Hello world! & rdquo; typeface.
The above is the simplest hello world program for node. Node.js as a server programming technique, another basic hello world program is to output Hello world on the web page.
Change the content of helloworld.js to the following content:
var http =require ("http”);//Get http object
//Create a server object using the createServer function of the http object. The parameter is a no-argument function. The function uses the response object to write the header information to the browser. Text
var server = http.createServer(function(request, response) {
response.writeHead(200, {“Content-Type”:“text/plain”});
response.write(“Hello World”);
response.end();
});
//server object listens 8888 Port
server.listen(8888);
Then execute node helloworld.js and then visit http://localhost:8888/
in the browser It will show Hello world!
The Ubuntu system uses Node.js to run Hello World. Just learn this trick and start getting started with Node.js.
In Linux, a signal is also called a soft interrupt. The process processes the signa
xmanager Passive can transfer graphics only when you log in to the ssh character in
If you do not modify the mysql root password through the password() function in Linux system, the my
Under Linux, you need to implement file transfer between two servers. You can use t
Instructions for using the Linux system xlsatom command
Linux how to use the text processing tool awk
How to use the Linux system swap and zram swap?
How to use the backup-manager tool to back up the Linux system
How to test the performance of a Linux disk using the DD command?
What about Chinese garbled when creating a website through Tomcat under Ubuntu?
Ubuntu desktop version to open the Bluetooth headset step
Linux uptime command operation example
Ubuntu dual system does not have a bootable device solution
Win10 official version final version number details
Linux common account is bound to 1024 or less port
gorgeous! Easily dress XP as Windows 7 (5)
How to uninstall the computer housekeeper in win7 system?
How to set wifi hotspot on win7 notebook
Officially confirmed that Windows 8 must load eight functions
Press F1 to boot into the system to cancel the method