Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wesbos/Learn-Node
Browse files Browse the repository at this point in the history
  • Loading branch information
timOTdev committed Jul 1, 2023
2 parents cffb169 + 79e1ecf commit 4759dd3
Show file tree
Hide file tree
Showing 27 changed files with 36,521 additions and 5,438 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
.DS_Store
*.log
.idea
dist/
haters/
variables.env
variables.env.now
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ These are the starter files and stepped solutions to accompany the LearnNode.com

You'll start your application in the `starter-files` directory — feel free to rename it.

If you need help, each folder number corresponds with where you should be at the *start* of a video. So if you are having trouble with video **24**, look to video **25** for the answer.
If you need help, each folder number corresponds with where you should be at the *start* of a video. So if you are having trouble with video **24**, look to folder **25** for the answer.

The stepped solutions are meant for you to apply on top of your existing code - they don't stand on their own.

Expand Down
3 changes: 3 additions & 0 deletions starter-files/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fund=false
audit=false
legacy-peer-deps=true
14 changes: 6 additions & 8 deletions starter-files/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
const express = require('express');
const session = require('express-session');
const mongoose = require('mongoose');
const MongoStore = require('connect-mongo')(session);
const MongoStore = require('connect-mongo');
const path = require('path');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const passport = require('passport');
const promisify = require('es6-promisify');
const flash = require('connect-flash');
Expand All @@ -24,8 +22,8 @@ app.set('view engine', 'pug'); // we use the engine pug, mustache or EJS work gr
app.use(express.static(path.join(__dirname, 'public')));

// Takes the raw requests and turns them into usable properties on req.body
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// Exposes a bunch of methods for validating data. Used heavily on userController.validateRegister
app.use(expressValidator());
Expand All @@ -40,14 +38,14 @@ app.use(session({
key: process.env.KEY,
resave: false,
saveUninitialized: false,
store: new MongoStore({ mongooseConnection: mongoose.connection })
store: new MongoStore({ mongoUrl: process.env.DATABASE })
}));

// // Passport JS is what we use to handle our logins
// Passport JS is what we use to handle our logins
app.use(passport.initialize());
app.use(passport.session());

// // The flash middleware let's us use req.flash('error', 'Shit!'), which will then pass that message to the next page the user requests
// The flash middleware let's us use req.flash('error', 'Shit!'), which will then pass that message to the next page the user requests
app.use(flash());

// pass variables to our templates + all requests
Expand Down
Loading

0 comments on commit 4759dd3

Please sign in to comment.