Skip to content

Commit 8c458bf

Browse files
committed
Add basic implementation of Express app
1 parent 7042dae commit 8c458bf

File tree

3 files changed

+438
-0
lines changed

3 files changed

+438
-0
lines changed

app.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const express = require("express");
2+
const app = express();
3+
const PORT = 3000;
4+
5+
// Creates a GET endpoint at the root URL that returns a string
6+
// () => {} is the alternative to function() {}; it's called an arrow function!
7+
app.get("/", (request, response) => {
8+
response.send("Hello, world!");
9+
});
10+
11+
// Starts the server on port 3000
12+
app.listen(PORT, () => {
13+
console.log(`Server listening on port ${PORT}!`);
14+
});

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"main": "app.js",
3+
"dependencies": {
4+
"express": "^4.18.2"
5+
}
6+
}

0 commit comments

Comments
 (0)