Code Monkey home page Code Monkey logo

ang-auth's People

Stargazers

 avatar

Watchers

 avatar

ang-auth's Issues

Make sure to run mongod

just incase anyone cannot get their server up an running on the first try, make sure you open a new terminal tab and run mongod

READ THIS FIRST!

This application uses the todo code we worked on earlier in the week but includes Authentication and authorization with sessions.

Make sure your not inside of the wdi-remote-r2d2 class repo and then clone this repo to your local machine. Run npm install and you should be good to start nodemon and start exploring.

As you peruse the code you'll notice several things:

  1. The authentication syntax in the controllers directory is almost exactly the same as in Project 2
    • There are no routes that render forms
    • Routes send json instead of rendering views or redirecting
    • Redirects are handled in js/app.js with $state.go
  2. The syntax in the router file is a little more robust using a pattern to set the controller and the controller as from the router rather than in each individual partial.
  3. Examine all of the ui-sref's and you'll notice some syntax to pass params.
  4. Finally, CUIDADO, even though we have todos in this app, they are not yet embedded or in any way tied to a user.

As you look through this code I want you to make issues about code you're not sure about or nw syntax.

The title of your GitHub issue should contain the file name and the line number. In the body of the issue include your question or comment.

Feel free to answer each other's issues.

router.js line 20-21 controller/controllerAs in a state

.state('login', { url: '/login', templateUrl: '/partials/login.html', controller: 'AuthCtrl', controllerAs: 'auth' })

We have not yet seen controllers being specified within a state. This concept is more unfamiliarity than confusion. I am assuming it is just another way to use a specific controller and when placed within a state, code becomes more clean (specifically the index html file).

user.js, Line 12, res.json()

What does res.json({user: user}) return? I'm thrown off by the .json. We've had it before in other lessons but I never bothered to figure it out.

server.js line 46/47 `mongoURI`

Is this a new var to be used for connecting to mongoose. This is a different var than we used in the past when hooking up our database.

ng-submit="auth.signup(userPass)"

this feels like a question you ask after not paying attention in class and the teacher JUST said it.

but.. ng-submit = "auth.signup(userPass)"....

can someone break this down for me?

ui-sref in index.html

Can someone please explain what ui-sref refers too? Its assigined to the buttons in index.html. Does it have to do with the router?

$state

You'll notice in app.js that we're injecting $state and using the method $state.go to redirect the user to a specific ui route.

Break down the syntax of $state.go() and explain what it's doing.

Refer to the documentation in here

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.