Code review for tinyApp assignment.
temp/ directory to store local files instead of listing them individually in the .gitignore filerequire('dotenv') as early as possible.env fileapp.set is a server configuration (not a middleware) group them with other server configuration variables.
app.set is a configurationreq.session.nowInMinutes. Now go and research about why it's useful (session fixation attacks).emails may not be validated with regular expressions.
if users()do { } while when applicable. DRY code!res.locals in app.use read more about them. DRY code!return statements as guards.{ and start line with }GET /:username. What if somebody's username is urls? route conflict with GET /urls. Lesson: users are intentionally or accidentally malicious. Guard for every edge case.if statements to check for truthy values and not the reverse, which increases logic complexity404. Do not treat unauthenticated users differentlydelete /urls/:id should only delete url if user is owner.401 on POST /urlsfor... in loops