# Setting Up Your First Node.js Application Step-by-Step

## Step 1: Installing Node.js

1.  Go to the official website: [https://nodejs.org](https://nodejs.org)
    
2.  Download the **LTS (Long Term Support)** version
    
3.  Install it like any standard application
    

👉 LTS is recommended because it's stable and widely supported.

* * *

## Step 2: Verify Installation

Open your terminal (Linux/macOS) or command prompt (Windows) and run:

```plaintext
node -v
```

You should see something like:

```plaintext
v20.x.x
```

Also check npm (Node Package Manager):

```plaintext
npm -v
```

* * *

## Step 3: Understanding Node REPL

REPL = **Read → Eval → Print → Loop**

Start it by typing:

```plaintext
node
```

Now you can run JavaScript directly:

```plaintext
> console.log("Hello Node")
Hello Node
```

### Why REPL matters:

*   Quick testing
    
*   Debugging small snippets
    
*   Learning JS behavior interactively  
    

Exit REPL:

```plaintext
.exit
```

* * *

## Step 4: Create Your First JavaScript File

Create a file:

```plaintext
touch app.js
```

Or manually create `app.js` and add:

```plaintext
console.log("Hello from Node.js!");
```

* * *

## Step 5: Run the Script

Execute the file using:

```plaintext
node app.js
```

Output:

```plaintext
Hello from Node.js!
```

This confirms your Node environment is working correctly.

* * *

## Step 6: Create a Simple "Hello World" Server

Now let’s build a basic HTTP server.

Update `app.js`:

```plaintext
const http = require("http");

const server = http.createServer((req, res) => {
  res.end("Hello World from Node.js Server!");
});

server.listen(3000, () => {
  console.log("Server is running on http://localhost:3000");
});
```
