Skip to content

Commit e3d57fa

Browse files
committed
Update index.md
1 parent e883024 commit e3d57fa

File tree

1 file changed

+3
-41
lines changed

1 file changed

+3
-41
lines changed

index.md

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,13 @@
44

55
## Q. How to create a simple server in Node.js that returns Hello World?
66

7-
**Step 01**: Create a project directory
8-
9-
```js
10-
mkdir myapp
11-
cd myapp
12-
```
13-
14-
**Step 02**: Initialize project and link it to npm
15-
16-
```js
17-
npm init
18-
```
19-
20-
This creates a `package.json` file in your myapp folder. The file contains references for all npm packages you have downloaded to your project. The command will prompt you to enter a number of things.
21-
You can enter your way through all of them EXCEPT this one:
22-
23-
```js
24-
entry point: (index.js)
25-
```
26-
27-
Rename this to:
28-
29-
```js
30-
app.js
31-
```
32-
33-
**Step 03**: Install Express in the myapp directory
34-
35-
```js
36-
npm install express --save
37-
```
38-
39-
**Step 04**: app.js
40-
417
```js
428
/**
43-
* Express.js
9+
* Hello World using Express
4410
*/
4511
const express = require('express');
12+
13+
// create instance of express
4614
const app = express();
4715

4816
app.get('/', function (req, res) {
@@ -54,12 +22,6 @@ app.listen(3000, function () {
5422
});
5523
```
5624

57-
**Step 05**: Run the app
58-
59-
```bah
60-
node app.js
61-
```
62-
6325
**⚝ [Try this example on CodeSandbox](https://codesandbox.io/s/hello-world-in-nodejs-ue3cs3)**
6426

6527
<div align="right">

0 commit comments

Comments
 (0)