Skip to content

Commit d34993e

Browse files
committed
Update controllers to use arrow functions in hello world example
1 parent 6ff4822 commit d34993e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

helloworld.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ const express = require("express");
22
const app = express();
33
const PORT = 3000;
44

5-
app.get("/", function(req, res) {
5+
app.get("/", (req, res) => {
66
res.send("Hello World!");
77
});
88

9-
app.post("/", function(req, res) {
9+
app.post("/", (req, res) => {
1010
res.send(`Hello, i got a ${req.method} request`);
1111
});
1212

13-
app.put("/", function(req, res) {
13+
app.put("/", (req, res) => {
1414
res.send(`Hello, i got a ${req.method} request`);
1515
});
1616

17-
app.delete("/", function(req, res) {
17+
app.delete("/", (req, res) => {
1818
res.send(`Hello, i got a ${req.method} request`);
1919
});
2020

21-
const server = app.listen(PORT, function() {
21+
const server = app.listen(PORT, () => {
2222
console.log(`You're listening to the smooth sounds of port ${PORT}...`);
2323
});

0 commit comments

Comments
 (0)