Fixing typo (#32936)

* Fixing typo:  Implement the Serialization of a Passport User

Fixing typo in  "Implement the Serialization of a Passport User" curriculum page under "Advanced Node and Express" topic

* Fix typo in 'logging a user out' page

Fixing typo in 'logging a user out' page
This commit is contained in:
amgusain
2018-10-31 18:51:11 -07:00
committed by Paul Gamble
parent e3afefd2a2
commit d6bbd72195
2 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ challengeType: 2
## Description ## Description
<section id='description'> <section id='description'>
As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>. As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>.
Right now we're not loading an actually users object since we haven't set up our database. This can be done many different ways, but for our project we will connect to the database once when we start the server and keep a persistent connection for the full life-cycle of the app. Right now we're not loading an actual user object since we haven't set up our database. This can be done many different ways, but for our project we will connect to the database once when we start the server and keep a persistent connection for the full life-cycle of the app.
To do this, add MongoDB as a dependency and require it in your server. (<code>const mongo = require('mongodb').MongoClient;</code>) To do this, add MongoDB as a dependency and require it in your server. (<code>const mongo = require('mongodb').MongoClient;</code>)
Now we want to the connect to our database then start listening for requests. The purpose of this is to not allow requests before our database is connected or if there is a database error. To accomplish you will want to encompass your serialization and your app listener in the following: Now we want to the connect to our database then start listening for requests. The purpose of this is to not allow requests before our database is connected or if there is a database error. To accomplish you will want to encompass your serialization and your app listener in the following:
<pre>mongo.connect(process.env.DATABASE, (err, db) => { <pre>mongo.connect(process.env.DATABASE, (err, db) => {

View File

@ -14,7 +14,7 @@ In passport, unauthenticating a user is as easy as just calling <code>req.logout
req.logout(); req.logout();
res.redirect('/'); res.redirect('/');
});</pre> });</pre>
You may have noticed we also we're not handling missing pages (404), the common way to handle this in Node is with the following middleware. Go ahead and add this in after all your other routes: You may have noticed that we're not handling missing pages (404), the common way to handle this in Node is with the following middleware. Go ahead and add this in after all your other routes:
<pre>app.use((req, res, next) => { <pre>app.use((req, res, next) => {
res.status(404) res.status(404)
.type('text') .type('text')