Tell us what’s happening:
Describe your issue in detail here.
'use strict';
require('dotenv').config();
const express = require('express');
const myDB = require('./connection');
const fccTesting = require('./freeCodeCamp/fcctesting.js');
const app = express();
fccTesting(app); //For FCC testing purposes
app.use('/public', express.static(process.cwd() + '/public'));
app.set('view engine', 'pug');
app.use(express.json());
app.use(passport.initialize()); // Used to initialize passport
app.use(passport.session()); // Used to persist login sessions
app.use(session({
secret: process.env.SESSION_SECRET,
resave: true,
saveUninitialized: true,
cookie: { secure: false }
}),passport.session(),passport.initialize());
app.use(express.urlencoded({ extended: true }));
app.route('/')
.get((req, res) => {
res.render(process.cwd() + '/views/pug/index.pug',{title: 'Hello', message: 'Please login'});
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log('Listening on port ' + PORT);
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Challenge: Set up Passport
Link to the challenge: