GithubHelp home page GithubHelp logo

meanappsfiles's Introduction

MEANAppsFiles

This course is out of date.

Express Changes

The latest version of express has deprecated the body parser middleware.

That means that when you see the following line of code:

app.use(bodyParser());

you should instead use the following two lines of code:

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

The latest version of express has also changed the session middleware a little bit and now requires that you explicitly specify a value for the resave parameter and the saveUninitialized parameter. So in the module on authentication when you see the following code:

app.use(session({secret: 'multi vision unicorns'}))

you should instead use the following code:

app.use(session({secret: 'multi vision unicorns',resave:false,saveUninitialized:false}));

Angular Changes

In addition to that, Angular 1.3 now requires a base tag when using html5Mode routing. In your layout.jade file (and maybe earlier in your index.jade), in the head you should place the following line of code:

base(href="/")

MongoDB Changes

Current versions of MongoDB require a "query" when calling the remove function. So periodically in the course we will delete all the users from the db with the following command:

db.users.remove()

But instead, you need to pass an empty "query object" into the remove function like this:

db.users.remove({})

Notes: To run the node server, type "node web-server.js" or "nodemon web-server.js" from the directory that contains the web-server.js file

Crypto Changes

In more recent versions of node.js update() and digest() are legacy methods. The new approach is to use the streaming API methods write() end() and read();

function hashPwd(salt, pwd){
  var hmac = crypto.createHmac('sha1', salt);
  hmac.setEncoding('hex');
  hmac.write(pwd);
  hmac.end();
  return hmac.read();
}

meanappsfiles's People

Contributors

joeeames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meanappsfiles's Issues

hide the salt and hashed_pwd on the client side

Hello,

thank you very much for your course, it is a really good piece of knowledge !

At some point during the explanation you mention that salt and hashed_pwd should not be transmit to the client side of the angular app.
Could you please highlight exactly where the filtering to remove these two fields should be made on the server side ?

I tried in the passport.js file but this confuse the update procedure for the profile...

passport.deserializeUser(function(id, done) {
        User.findOne({_id:id}).exec(function(err, user) {
            if(user) {
                var mockUser = JSON.parse(JSON.stringify(user));
                delete mockUser['hashed_pwd'];
                delete mockUser['salt'];
                return done(null, mockUser);
            } else {
                return done(null, false);
            }
        })
    });

Thanks in advance for your help

using html instead of jade

Hi, I have been following this tutorial and I tried to use html instead of Jade, right now I'm stacked in the persist login between page refreshes because you used a jade feature that cannot be used in html, can you suggest a method to be used to persist the user login please ?

Reference error and mvNavBarLoginCtrl.js issue

Joe,
After completing the "Adding the login display" module in Authentication I am encountering an issue with jquery. The error is:
ReferenceError: define is not defined, jquery.js line 1
define(['./core',
'./selector',
'./traversing',
etc...
], function (jQuery) {
'use strict';
return (window.jQuery = window.$ = jQuery);
});

The console.log("I'm not done yet."); from mvNavBarLoginCtrl.js is also not rendering.
I have tried googleing this issue to no avail. My jquery.js version is 3.1.0 installed globally.
Thanks,
Dave

Bootstrap.css File

Your bootstrap.css file on Github does not match the one in your demo files. I was having some odd css issues with coloring and panels not working properly. I then copied the bootstrap.css file out of your demo files and it worked perfectly.

Firefox post error

Hi Joe,

Could not find your email so decided to leave this question here.
First of all - thanks for the great course - it was really helpful and interesting.

Only problem is, then I'm trying to run your example code from MEAN stack course, using Firefox browser I get server error 500 trying to Log in, which happens cause POST request is empty, so the server fails trying to obtain user object from it. This problem happens only in FF - in IE and Chrome everything runs smooth. Can you please suggest - what can be the cause of this problem?

thanks and kind regards, Konstantin

favicon.ico

Great course so far. Where you supposed to supply the favicon file?

Issues with testing chapter

Immediately after installing the devDependencies in the testing chapter, this pops up in Webstorm:

screen shot 2015-06-23 at 11 19 05

And when I run 'karma start' I get this:

screen shot 2015-06-23 at 11 24 42

Persisting Login Between Page Refresh

Hi Joe - I'm working through your MEAN stack pluralsight course. It's excellent and I'm learning a ton.

I have a question about the bootstrapped user approach in the case where the server is re-started. It happened during your course when nodemon re-started the server even though you changed only client code. When the server was re-started, it left a desynchronized state with the client. There was an authenticated user on the client but no authenticated user on the server. You recognized this and then manually logged in again. But considering a live scenario, at that point routing on the client would have failed since the data requests to the server would be rejected on routes requiring an authenticated user.

Am I missing something in my representation of this scenario (the effect of re-starting the server where there is an active client)? If I've got this right, I wonder how you think about handling that case yet still want to bootstrap a user for login persistence across page refreshes?

Thanks again for your exceptional set of pluralsight courses!

Elliot

where can i get the finished version of the course?

can you provide a working version of this course? i was unable to get the user login to work and i would like to compare the files to see what i did wrong. i don't know how many times i went through the videos... it should work but it doesn't. i'm getting a 500 internal server error for some reason.

Creating the Angular Application

Main partial doesn’t seem to be working
app.js
.when('/', { templateUrl: '/partials/main', controller: 'mainCtrl'})
});
angular.module('app').controller('mainCtrl', function($scope){
$scope.myVar = "Hello Angular";
});

server.js
.when('/', { templateUrl: '/partials/main', controller: 'mainCtrl'})
});
angular.module('app').controller('mainCtrl', function($scope){
$scope.myVar = "Hello Angular";
});

When someone requests /partials/main, express should render the
main.jade inside the partials directory inside the views directory. The
server is running correctly but I don’t see “This is a Partial … Hello
Angular”
lakenney/multivision@9c41ca8
I reviewed the files a few times so it all looks good but I get nothing in the browser.

Root Path Issue

I had to modify this line in config.js by adding another ../
rootPath = path.normalize(__dirname + '../../../');

rootPath becomes:
{ rootPath: '/home/rob/Documents/CodeSchoolNotes/MeanStack/MultiVision/',
db: 'mongodb://localhost/multivision',
port: 3030 }

instead of:
{ rootPath: '/home/rob/Documents/CodeSchoolNotes/MeanStack/MultiVision/server/',
db: 'mongodb://localhost/multivision',
port: 3030 }

I am surprised no one else seems to have this issue.

Rob

bodyParser constructor deprecated

Hi,

I'm struggling to follow along ... probably need to go back and do more work on the fundamentals as there is a lot of new material in here for me.

Meantime: It seems that bodyParser has been deprecated. A google search suggested replacing the app.use(bodyParser()) statement as follows.

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

Should this work? I don't seem to be getting the CSS files delivered when I look at it after step "Creating a Layout" and by time I've followed "Creating the Angular Application", I'm not getting the main-content delivered. The only difference I can spot from the tutorial code and my code is the section above ...

Thanks for the advice,

David

Deprecation: TypeError: Object #<Mongoose> has no method 'schema'

Mongoose version: 4.0.1

var messageSchema = mongoose.schema();
                             ^
TypeError: Object #<Mongoose> has no method 'schema'
    at Object.<anonymous> 
(/multivision/server.js:37:30)

Solution:

before:

var messageSchema = mongoose.schema({ message: String });
var Message = mongoose.model('Message', messageSchema);

after:

var Message = mongoose.model('Message', { message: String });

jade --currentUser.jade

I am following this tutorial from pluralsight.. it is awesome.

One thing.. I got stuck jade code from currentUser.jade. Now, I go with just html format not jade.

if !!boostrappedUser
script.
window.bootstrappedUserObject = !{JSON.stringify(bootstrappedUser)}

This line needs to be converted to HTML..

Can you suggest ?

Persisting Login between Page Refreshes Issue...

Hi Joe,

I'm going through your course and it's great!

I've run into an issue that I'm hoping you can direct me toward a solution.

I'm going through the "Persisting Login between Page Refreshes" video in the "Security and Authorization" section of your course and am at the part where I change the code in routes.js from "res.render('index')" to res.render('index', {bootstrappedUser: req.user}).

When I go to refresh the page it renders the following:

ReferenceError: req is not defined
at C:\Dev\FireflyXP\server\config\routes.js:25:25
at Layer.handle [as handle_request] C:\Dev\FireflyXP\node_modules\express\lib\router\layer.js:82:5)
at next (C:\Dev\FireflyXP\node_modules\express\lib\router\route.js:110:13)
at Route.dispatch (C:\Dev\FireflyXP\node_modules\express\lib\router\route.js:91:3)
at Layer.handle [as handle_request] C:\Dev\FireflyXP\node_modules\express\lib\router\layer.js:82:5)
at C:\Dev\FireflyXP\node_modules\express\lib\router\index.js:267:22
at Function.proto.process_params C:\Dev\FireflyXP\node_modules\express\lib\router\index.js:321:12)
at next (C:\Dev\FireflyXP\node_modules\express\lib\router\index.js:261:10)
at SendStream.error (C:\Dev\FireflyXP\node_modules\express\node_modules\serve-static\index.js:107:7)
at SendStream.emit (events.js:95:17)

it seems to be having a problem with the req.user variable. Any ideas on what may be wrong?

bootstrap.css

Is the boostrap.css file setup correctly? I'm not getting the same stylesheet affects as in the screen cast. When I replace it with something else it seems to work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.