How to run server written in js with Node.js

前端 未结 6 1259
梦毁少年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条回答
  •  Happy的楠姐
    2020-12-24 13:29

    Nodejs is a scripting language (like Python or Ruby, and unlike PHP or C++). To run your code, you need to enter a command in the terminal / shell / command prompt. Look for an application shortcut in your operating system by one of those names.

    The command to run in the terminal will be

    node server.js
    

    But you will first need to browse in the terminal to the same folder as the file server.js. The syntax for using the terminal varies by operating system, look for its documentation.

提交回复
热议问题