Authentication API backed by MongoDB
Side project to better understand authentication with Node.js
To run this app, you should have a MongoDB database up and running on port 27017.
Clone into your directory, type
npm install
then type
node app.js
Open a second tab or window in Terminal, visit the angular-src
directory and type
ng serve
which loads the web UI.
To debug app using Safari 10.1.2, visit Safari Preferences, Advanced, and check Show Develop menu in menu bar. Then hold Option-Command-I to open the Web Inspector.
Check status in MongoDB
> show dbs
meanauth 0.000GB
> use meanauth
switched to db meanauth
> show collections
users
> db.users.find()
{ "_id" : ObjectId("596ba1d345fbc0bf8ae85001"), "name" : "JohnJohn", "email" : "dude@g.net", "username" : "Dude", "password" : "$2a$10$Qmm.l007BDoIio1t079AY.Y6RPFfTJsNXMlk83u3Pv/0SF7QKOfky", "__v" : 0 }
{ "_id" : ObjectId("596ba201d6d733bf92bdd5a0"), "name" : "EasyE", "email" : "Eaze@g.net", "username" : "EDude", "password" : "$2a$10$CbMT9t5Ak/8v7IdIzJNhZ.bZeb2t160CV/ACw.0eq5lTJYEVyjYUi", "__v" : 0 }
{ "_id" : ObjectId("5970c7758965d9674f8c4b3e"), "name" : "Mister Browski", "email" : "Browski@g.net", "username" : "misterBee", "password" : "$2a$10$qeiaDLdA1IZNdMrkTJkxx.cf6daYAaVtM5EYaQbtB9FdYiZpPdoCq", "__v" : 0 }
You can check out the app running live here
POST localhost:3000/register
POST localhost:3000/authenticate
GET localhost:3000/profile
Following Traversy Media for this project
- MEAN Stack Front To Back [Part 1] - Project Introduction
- MEAN Stack Front To Back [Part 2] - Express Setup & Routes
- MEAN Stack Front To Back [Part 3] - User Model & Register
- MEAN Stack Front To Back [Part 4] - API Authentication and Token
- MEAN Stack Front To Back [Part 5] - Angular 2 Components & Routes
- MEAN Stack Front To Back [Part 6] - Register Component, Validation & Flash Messages
- MEAN Stack Front To Back [Part 7] - Auth Service & User Registration
- MEAN Stack Front To Back [Part 8] - Login & Logout
- MEAN Stack Front To Back [Part 9] - Protected Requests & Auth Guard
- MEAN Stack Front To Back [Part 10] - App Deployment to Heroku
I'm on Twitter & StackOverflow Any bugs or feature requests please send me an issue
Copyright 2017 Michael Vilabrera
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.