zoukankan      html  css  js  c++  java
  • node.js 笔记一

    现在地址:http://nodejs.org/download/

    我的机器是windows的,选择的文件是,是编译后的版本:Windows Installer (.msi)  32-bit

    example

    打开你最喜欢的编辑器,创建一个helloworld.js文件,输入console.log("Hello World");后保存

    打开Node.js的CMD窗口,将文件拖拽到窗口中,输入node js文件路径 

    Http版例子

    编写 q.js 代码如下:

    1. var http = require('http');   
    2. server = http.createServer(function (req, res) {   
    3.       res.writeHeader(200, {"Content-Type""text/plain"});   
    4.       res.end("Hello World ");   
    5. })   
    6. server.listen(8000);   
    7. console.log("httpd start @8000");   

    运行 node q.js按照上面node.js cmd的方法,控制台显示 httpd start @8000 
    打开浏览器访问 http://localhost:8000/ 浏览器显示 Hello World

  • 相关阅读:
    asp.net 2.0 run
    Regular Expression
    assembly
    asp.net loading..
    session
    asp.net performance
    asp.net page order
    interface
    UVA 562 Dividing coins
    UVA 10003 Cutting Sticks
  • 原文地址:https://www.cnblogs.com/bugs/p/3510171.html
Copyright © 2011-2022 走看看