From 78d86a4f3bf81e27b7261bb5821120d97078fba5 Mon Sep 17 00:00:00 2001 From: skoparde <33005639+her0d0tus@users.noreply.github.com> Date: Thu, 26 Jul 2018 00:11:23 -0400 Subject: [PATCH] fix(challenges): fix typo in a node and express challenge --- .../05-apis-and-microservices/basic-node-and-express.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenges/05-apis-and-microservices/basic-node-and-express.json b/challenges/05-apis-and-microservices/basic-node-and-express.json index ad3e9d593..2242d8ab9 100644 --- a/challenges/05-apis-and-microservices/basic-node-and-express.json +++ b/challenges/05-apis-and-microservices/basic-node-and-express.json @@ -162,7 +162,7 @@ "Middleware can be mounted at a specific route using app.METHOD(path, middlewareFunction). Middleware can also be chained inside route definition.", "Look at the following example:", "
app.get('/user', function(req, res, next) {
req.user = getTheUserSync(); // Hypothetical synchronous operation
next();
}, function(req, res) {
res.send(req.user);
})
", - "This approach is useful to split the server operations into smaller units. That leads a to a better app structure, and the possibility to reuse code in different places. This approach can also be used to perform some validation on the data. At each point of the middleware stack you can block the execution of the current chain and pass control to functions specifically designed to handle errors. Or you can pass control to the next matching route, to handle special cases. We will see how in the advanced Express section.", + "This approach is useful to split the server operations into smaller units. That leads to a better app structure, and the possibility to reuse code in different places. This approach can also be used to perform some validation on the data. At each point of the middleware stack you can block the execution of the current chain and pass control to functions specifically designed to handle errors. Or you can pass control to the next matching route, to handle special cases. We will see how in the advanced Express section.", "In the route app.get('/now', ...) chain a middleware function and the final handler. In the middleware function you should add the current time to the request object in the req.time key. You can use new Date().toString(). In the handler, respond with a JSON object, taking the structure {time: req.time}.", "Hint: The test will not pass if you don’t chain the middleware. If you mount the function somewhere else, the test will fail, even if the output result is correct." ],