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: Node-and-Packages.md
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,43 @@ To restart a running application
111
111
112
112
## 8. `express` Package
113
113
114
-
```javascipt
114
+
`express` is a Node package that allows us to create web servers to host APIs that allow for http request, reponses and supports HTTP methods e.g GET and POST.
115
+
116
+
Install `express`
117
+
118
+
`npm install express`
119
+
120
+
An example of web server JavaScript code that will listen on a specific port and render "Hello, world" if the API address is visited.
121
+
122
+
#### index.js file
123
+
124
+
```javascript
125
+
constexpress=require('express');
126
+
constapp=express();
127
+
constport=3000;
128
+
129
+
app.get('/', (request, response) => {
130
+
response.send(`Hello World!`);
131
+
});
132
+
133
+
app.listen(port, () => {
134
+
console.log(`Example app listening at http://localhost:${port}`);
0 commit comments