Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
World's smallest refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
philbarresi committed Apr 6, 2018
1 parent cbc7c1b commit 4e36c51
Show file tree
Hide file tree
Showing 2 changed files with 420 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Lecture Code/lecture_10/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ app.use("/admin", function(request, response, next) {
console.log(
"Someone is trying to get access to /admin! We're stopping them!"
);
response.status(500).send("You cannot access /admin");
response.status(403).send("You cannot access /admin");
});

// 5. Where we add a number to the request object
Expand Down Expand Up @@ -132,17 +132,16 @@ app.use(function(request, response, next) {
next();
});

const logRequest = (req, res, next) => {
console.log(req);
next();
};

// Get the best movies
app.get(
"/api/movies/best",
(req, res, next) => {
console.log(req);
next();
},
(req, res, next) => {
console.log(req);
next();
},
logRequest,
logRequest,
async (request, response, next) => {
const popularMovies = await movieData.getPopularMovies();

Expand Down
Loading

0 comments on commit 4e36c51

Please sign in to comment.