Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Live check for Pininterest clone
Browse files Browse the repository at this point in the history
a2937 committed Nov 12, 2023
1 parent 305f12c commit 3121c56
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions apps/build-a-pinterest-clone/server.js
Original file line number Diff line number Diff line change
@@ -8,35 +8,41 @@ var passport = require('passport');
var session = require('express-session');
var mongoStore = require('connect-mongo')(session);

var bodyParser = require('body-parser')
var bodyParser = require('body-parser');

require('./config/passport')(passport);
var app = express();

app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

mongoose.connect(process.env.DB_URI);

app.use('/', express.static(process.cwd() + '/public'));
app.use('/', express.static(process.cwd() + '/views'));
app.use('/assets', express.static(process.cwd() + '/assets'));

app.use(session({
secret: process.env.SECRET_SESSION || 'superSecureSecret',
resave: true,
app.use('/', express.static(process.cwd() + '/public'));
app.use('/', express.static(process.cwd() + '/views'));
app.use('/assets', express.static(process.cwd() + '/assets'));

app.use(
session({
secret: process.env.SECRET_SESSION || 'superSecureSecret',
resave: true,
saveUninitialized: true,
store: new mongoStore({
mongooseConnection: mongoose.connection
})
}));
})
);

app.use(passport.initialize());
app.use(passport.session());

app.get('/status/ping', (req, res) => {
res.send({ msg: 'pong' }).status(200);
});

routes(app, passport);

const portNum = process.env.PORT || 3000;
app.listen(portNum, function () {
console.log('Node.js listening on port ' + portNum + '...');
});
app.listen(portNum, function () {
console.log('Node.js listening on port ' + portNum + '...');
});

0 comments on commit 3121c56

Please sign in to comment.