Nodejs Server-side scripting

Source: Internet
Author: User
Tags node server

First is the installation, the installation is very simple, download an MSI file after the next step, no difficulty

And then the first Hello World test file

var http = require (' http '); Http.createserver (function (request, response) {//Send HTTP Header//HTTP status value: 200:ok//Content Type: Tex T/plainresponse.writehead ($, {' Content-type ': ' Text/plain '});//Send response data "Hello World" response.end (' Hello world\n ');}). Listen (8888);//terminal print the following information Console.log (' Server running at http://127.0.0.1:8888/');

Then cmd opens the control window, locates the root path of the file and compiles it, for example, this is the path of my file, so enter this in the controller.

C:\Program Files\nodejs>node Server.jsserver running at http://127.0.0.1:8888/

and then browser input

http://127.0.0.1:8888/

will be able to win "Hello World"

Nodejs Server-side scripting

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.