Skip to content

Commit b15a936

Browse files
authored
chore: log URL with port on app start (#26)
1 parent a16cf30 commit b15a936

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

advanced-integration/server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "dotenv/config";
22
import express from "express";
33
import * as paypal from "./paypal-api.js";
4+
const {PORT = 8888} = process.env;
45

56
const app = express();
67
app.set("view engine", "ejs");
@@ -38,4 +39,6 @@ app.post("/api/orders/:orderID/capture", async (req, res) => {
3839
}
3940
});
4041

41-
app.listen(8888);
42+
app.listen(PORT, () => {
43+
console.log(`Server listening at http://localhost:${PORT}/`);
44+
});

standard-integration/server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "dotenv/config"; // loads variables from .env file
22
import express from "express";
33
import * as paypal from "./paypal-api.js";
4+
const {PORT = 8888} = process.env;
45

56
const app = express();
67

@@ -28,4 +29,6 @@ app.post("/my-server/capture-paypal-order", async (req, res) => {
2829
}
2930
});
3031

31-
app.listen(8888);
32+
app.listen(PORT, () => {
33+
console.log(`Server listening at http://localhost:${PORT}/`);
34+
});

0 commit comments

Comments
 (0)