Question: I'm setting up a new server in Node.js, and the terminal keeps on saying Reference Error: server is not defined. Is there another way to setup a server? Or is there a syntax error?

```
const http = require('http');

http.createServer((req, res) => {
    console.log(req)
});

server.listen(3000);

```

Answer: 
you may try this way also.

```
const http = require('http');

http.createServer((req, res) => {
    console.log(req)
}).listen(3000);

```
You have created server with http.createServer((req,res)) but you are listening to server variable, which not defined in your code. So you can either defined it or use listen by chaining it. 

```
const http = require('http');

const server = http.createServer((req, res) => {
    console.log(req)
});

server.listen(3000);

```

Or

```
const http = require('http');

http.createServer((req, res) => {
    console.log(req)
}).listen(3000);

```