Files
freeCodeCamp/curriculum/challenges/english/06-information-security-and-quality-assurance/advanced-node-and-express/how-to-put-a-profile-together.english.md
Randell Dawson 9cd57105af fix(curriculum): changed test text to use should for Information Security and Quality Assurance (#37763)
* fix: changed test text to use should

* fix: corrected typo

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: corrected typo

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: remove unnecessary backslash

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: simplified text

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>

* fix: added period

Co-Authored-By: Manish Giri <manish.giri.me@gmail.com>
2019-11-20 09:58:14 -05:00

2.0 KiB

id, title, challengeType, forumTopicId
id title challengeType forumTopicId
5895f70ef9fc0f352b528e6b How to Put a Profile Together 2 301554

Description

As a reminder, this project is being built upon the following starter project on Glitch, or cloned from GitHub. Now that we can ensure the user accessing the /profile is authenticated, we can use the information contained in 'req.user' on our page! Go ahead and pass the object containing the variable username equaling 'req.user.username' into the render method of the profile view. Then go to your 'profile.pug' view and add the line h2.center#welcome Welcome, #{username}! creating the h2 element with the class 'center' and id 'welcome' containing the text 'Welcome, ' and the username! Also in the profile, add a link to /logout. That route will host the logic to unauthenticate a user. a(href='/logout') Logout Submit your page when you think you've got it right.

Instructions

Tests

tests:
  - text: You should correctly add a Pug render variable to /profile.
    testString: getUserInput => $.get(getUserInput('url')+ '/_api/server.js') .then(data => { assert.match(data, /\/views\/pug\/profile[^]*username:( |)req.user.username/gi, 'You should be passing the variable username with req.user.username into the render function of the profile page'); }, xhr => { throw new Error(xhr.statusText); })

Challenge Seed

Solution

/**
  Backend challenges don't need solutions, 
  because they would need to be tested against a full working project. 
  Please check our contributing guidelines to learn more.
*/