Skip to content

Commit f19d961

Browse files
[mabel] Edit express_basic_example_with_router to print out the server address
1 parent b6d49f4 commit f19d961

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

express_basic_example_with_router.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
const express = require("express");
22
const app = express();
3+
const PORT = 3000;
4+
35
const bookRouter = require("./routes/books");
46
const userRouter = require("./routes/users");
57

68
app.use("/books", bookRouter);
79
app.use("/users", userRouter);
810

9-
const server = app.listen(3000, function() {
10-
console.log("Application started....");
11+
const server = app.listen(PORT, () => {
12+
console.log(`Server running at http://localhost:${PORT}`);
1113
});

0 commit comments

Comments
 (0)