You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-42Lines changed: 34 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,7 @@ node -v
35
35
npm -v
36
36
```
37
37
38
-
02.**Create a Project Folder**:
39
-
40
-
38
+
2.**Create a Project Folder**:
41
39
42
40
```powershell
43
41
mkdir my-node-project
@@ -76,66 +74,60 @@ _Express.js_ is a framework that simplifies building Node.js backend application
76
74
1.**Create `server.js`**: The entry point of your application [1].
77
75
78
76
```javascript
79
-
constexpress=require('express');
80
-
constapp=express();
81
-
82
-
app.get('/', (req, res) => {
83
-
res.send('<h1>Hello, Express.js Server!</h1>');
84
-
});
85
-
86
-
constport=3000;
87
-
app.listen(port, () => {
88
-
console.log(`Server is running on port ${port}`);
89
-
});
90
-
```
77
+
constexpress=require("express");
78
+
constapp=express();
91
79
92
-
02. **Run Your Server**:
80
+
app.get("/", (req, res) => {
81
+
res.send("<h1>Hello, Express.js Server!</h1>");
82
+
});
93
83
84
+
constport=3000;
85
+
app.listen(port, () => {
86
+
console.log(`Server is running on port ${port}`);
87
+
});
88
+
```
94
89
90
+
2.**Run Your Server**:
95
91
92
+
```powershell
93
+
node server.js
96
94
```
97
95
98
-
node server.js
99
-
```
100
-
101
96
3.**Define Routes**: How your server responds to different URL requests [2].
102
97
103
98
```javascript
104
-
app.get('/about', (req, res) => {
105
-
res.send('This is the about page');
106
-
});
107
-
108
-
app.get('/contact', (req, res) => {
109
-
res.send('This is the contact page');
110
-
});
111
-
```
112
-
113
-
Use `nodemon`for automatic server restarts:
99
+
app.get("/about", (req, res) => {
100
+
res.send("This is the about page");
101
+
});
114
102
103
+
app.get("/contact", (req, res) => {
104
+
res.send("This is the contact page");
105
+
});
106
+
```
115
107
108
+
Use `nodemon` for automatic server restarts:
116
109
110
+
```powershell
111
+
npm install -g nodemon
112
+
nodemon server.js
117
113
```
118
114
119
-
npm install -g nodemon
120
-
nodemon server.js
121
-
```
122
-
123
115
## **Proxy and CORS in Vite**
124
116
125
117
_Vite_ is a build tool that improves the front-end development experience. Configuring a proxy in `vite.config.js` is essential for redirecting API calls during development [3].
0 commit comments