This article mainly introduces a simple node. js server example. This article implements a simple helloworld example and shows how to run this server, for more information, see the following example: hello world.
It seems that the first section of each language tutorial will talk about this, and we are no exception.
If you're writing the node. JS code, Node-inspector is a must-have option, much better than node. JS's built-in debugger. It's similar to Chrome's JavaScript debugger.To install with NPM:$ npm install -g node-inspectorThen you need to connect to
This article focuses on the method of creating the first application for node. js, as well as the introduction of five different scenarios. So that everyone can learn something, learn this, and then let's come and see this article.
First, let's try to create the first application:
Before we create the first "Hello, world!" app for
Simply put, node. JS is the JavaScript that runs on the server. node. JS is a platform built on the Chrome JavaScript runtime. node. JS is an event-driven I/O
directory is the nodetest1 directory. Enter:
The Code is as follows:
C: \ node \ nodetest1> node app. js
After you press enter, you will see:
The Code is as follows:
Express server listening on port 3000
Great. Open your browser and enter http: // localhost: 3000. You sh
directory is the nodetest1 Directory. enter:
The code is as follows:
C: \ node \ nodetest1> node app. js
After you press enter, you will see:
The code is as follows:
Express server listening on port 3000
Great. Open your browser and enter http: // localhost: 3000. you sh
If you want to reprint please specify the source http://blog.csdn.net/as645788Android app Development is over, a stable, basic function of the app has been delivered to the user! I had a conversation with my boss, and then I was ready to move to node. js, and part of the front-end function goes in! hahaha ~ ~ ~ next to
Node. js static server implementation method, node. js static Server
When you enter a url, the url may correspond to a resource (File) on the server or a directory. The So
you press enter, you will see:Copy codeThe Code is as follows:Express server listening on port 3000Great. Open your browser and enter http: // localhost: 3000. You should be able to see a welcome page of Express.
Now you have run your own Node JS WebServer with the Express engine and Ejs HTML template engine. Not very difficult, right?
Part 1-now, let's write
What is Node. js? Return the server-side javascript? I will not explain this concept in this article. I can search for it myself to find out that server-side js is not a new technology, but a recent node. the popularity of
path.
Node. js Website: http://nodejs.org/
Enter the tar xf node-v0.4.7.tar.gz in the Command window, node-v0.4.7.tar.gz for your own version.
Enter the cd node-v0.4.7 in the Command window and press Enter.
Enter./configure in the Command window and press Enter.
Enter make
This article mainly introduces how to easily create a node. js server (5): event processing program. This series of articles will create a complete node. js server step by step, if you need it, you can refer to the introduction of
First, create an applicationIf we use PHP to write back-end code, we need an Apache or Nginx http server, with MOD_PHP5 modules and php-cgi. From this perspective, the entire "Receive HTTP request and provide WEB page" requirement does not need PHP to handle at all.But for node. JS, the concept is completely different. When using
javacrip. the libraries with over stars are almost clear javascript.
2. google-based V8 javascript interpretation engine is very fast. As a server language, it may not be the fastest, but it must not be slow.
3. asynchronous + callback operations make the Node. js server highly concurrent
4. The npm and the community
Node. js static file server ultimate version, node. js static ultimate version
First, I would like to thank github for providing the source code on github. Compared with last night's static file server, it is a little more complex
/install.sh | sh
Check the version after running.
$node --versionv0.10.30
4) install OurJS
Select a suitable directory to run the following script (for example, under the/var/www directory)
npm install ourjscp -r node_modules/ourjs ./chmod 755 ./ourjs/ourjs.sh ./ourjs/ourjs.sh
The general process is to download ourjs from npm, then copy it from the node_modules directory, and change ourjs. sh to executable and run the service.
5) test http: // l
This article mainly introduces a simple node. js server example. This article implements a simple helloworld example and shows how to run this server, for more information, see the following example: hello world.
It seems that the first section of each language tutorial will talk about this, and we are no exception.
Installing the node. JS Environment sudo Install Nodejs sudo Install NPMFor node_module that depend on different environments, you can regenerate them using the following command RM -InstallIf you do not want to use the system's own node. js, you can use NVMCurl https:///raw.githubusercontent.com/creationix/nvm/v0.16.1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.