How to run server written in js with Node.js

前端 未结 6 1256
梦毁少年i
梦毁少年i 2020-12-24 12:33

I have installed node.js from here http://nodejs.org/ . in my windows8 machine. copied the example server code in my server.js file

var http = require(\'ht         


        
6条回答
  •  旧时难觅i
    2020-12-24 13:15

    If you are in a Linux container, such as on a Chromebook, you will need to manually browse to your localhost's address. I am aware the newer Chrome OS versions no longer have this problem, but on my Chromebook, I still had to manually browse to the localhost's address for your code to work.

    To browse to your locahost's address, type this in command line: sudo ifconfig

    and note the inet address under eth0.

    Otherwise, as others have noted, simply type node.js filename and it will work as long as you point the browser to the proper address.

    Hope this helps!

提交回复
热议问题