Skip to content

Commit 88e9f60

Browse files
jevtovichfhemberger
authored andcommitted
Added Getting Started guide (#1308)
1 parent f31591c commit 88e9f60

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Getting Started Guide
3+
layout: docs.hbs
4+
---
5+
6+
# How do I start with Node.js after I installed it?
7+
8+
Once you have installed Node, let's try building our first web server\
9+
Create a file named "app.js", and paste the following code:
10+
11+
```javascript
12+
const http = require('http');
13+
14+
const hostname = '127.0.0.1';
15+
const port = 3000;
16+
17+
const server = http.createServer((req, res) => {
18+
res.statusCode = 200;
19+
res.setHeader('Content-Type', 'text/plain');
20+
res.end('Hello World\n');
21+
});
22+
23+
server.listen(port, hostname, () => {
24+
console.log(`Server running at http://${hostname}:${port}/`);
25+
});
26+
```
27+
28+
After that, run your web server using ``` node app.js ```, visit http://localhost:3000, and you will see a message 'Hello World'

0 commit comments

Comments
 (0)