Home > Article > Web Front-end > Create a nodejs server easily (1): A simple nodejs server example_node.js
Let’s implement a simple example first, hello world.
It seems that the first section of every language tutorial talks about this, and we are no exception.
First we create a project directory. The directory can be defined by yourself. The directory in this case is e:/nodetest/.
Since we are building a server, I named the first file server.js.
Enter the following code in server.js:
Then we open cmd.
Use cd e:/nodetest/ to navigate to the project directory, and then execute the node server.js command to run the file;
Then open the browser and visit http://localhost:8888/, you will see a webpage that says "Hello World";
In fact, this is a simple working server, but it is too simple to do anything. But it doesn’t matter, follow me step by step, and I will teach you how to build a complete and usable server.
In the next section, we will analyze the composition of this code.