Tell us what’s happening:
Describe your issue in detail here.
ReferenceError: TextEncoder is not defined
12:27 PM
Your code so far
'use strict';
require('dotenv').config();
const express = require('express');
const myDB = require('./connection');
const fccTesting = require('./freeCodeCamp/fcctesting.js');
const pug = require('pug');
const session = require('express-session');
const passport = require('passport');
const ObjectID = require('mongodb').ObjectID;
const utf8 = require('utf8');
const app = express();
app.set('view engine','pug');
fccTesting(app); //For FCC testing purposes
app.use('/public', express.static(process.cwd() + '/public'));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(session({
secret: process.env.SESSION_SECRET,
resave: true,
saveUninitailized: true,
cookie: {secure: false}
}));
app.use(passport.initialize());
app.use(passport.session());
app.route('/').get((req, res) => {
res.render(process.cwd() + '/views/pug',{title: "Hello",
message: "Please login"});
});
passport.serializeUser((user, done) => {
done(null, user._id);
});
passport.deserializeUser((id, done) => {
// myDB.findOne({ _id: new ObjectID(id) }, (err, doc) => {
done(null, null);
//});
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log('Listening on port ' + PORT);
});
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; LM-K300) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36
Challenge: Serialization of a User Object
Link to the challenge: