├── 04 server setup
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── package-lock.json
│ ├── package.json
│ └── server.js
├── 05 installing npm packages.js
├── 07 moving to controllers
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── controllers
│ └── auth.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ └── server.js
├── 08 user model code.js
├── 08 user model
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ └── server.js
├── 09 applying middlewares
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .env
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ └── server.js
├── 11 connect to mongodb
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .env
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ └── server.js
├── 12 express validator
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .env
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 13 signup user
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .env
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 15 signup with sendgrid
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 16 send email on signup
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 17 account activation
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 18 user signin
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.css
│ │ ├── App.js
│ │ ├── App.test.js
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── logo.svg
│ │ └── serviceWorker.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 24 finishing signup
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ └── Signup.js
│ │ ├── core
│ │ │ └── Layout.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 26 activate account
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── Signin.js
│ │ │ └── Signup.js
│ │ ├── core
│ │ │ └── Layout.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 28 auth helpers
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ └── Layout.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 29 authenticate and signout
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ └── Layout.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ └── auth.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ └── auth.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 34 protect api endpoint
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 36 admin middleware
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 37 profile update page setup
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 38 errors cleanup
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 39 pre-populate profile update and handle jwt expiry
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 41 admin profile update
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 42 forgot password server
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 43 reset password server
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 44 forgot password client
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── Forgot.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 45 reset password client
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── Forgot.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Reset.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 47 google login server
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── Forgot.js
│ │ │ ├── Google.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Reset.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 48 login with facebook client
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── Facebook.js
│ │ │ ├── Forgot.js
│ │ │ ├── Google.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Reset.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 49 login with facebook server
├── .DS_Store
├── client
│ ├── .env
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── Facebook.js
│ │ │ ├── Forgot.js
│ │ │ ├── Google.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Reset.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── 51 getting ready for production
├── .DS_Store
├── client
│ ├── .gitignore
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── server.js
│ ├── src
│ │ ├── App.js
│ │ ├── Routes.js
│ │ ├── auth
│ │ │ ├── Activate.js
│ │ │ ├── AdminRoute.js
│ │ │ ├── Facebook.js
│ │ │ ├── Forgot.js
│ │ │ ├── Google.js
│ │ │ ├── PrivateRoute.js
│ │ │ ├── Reset.js
│ │ │ ├── Signin.js
│ │ │ ├── Signup.js
│ │ │ └── helpers.js
│ │ ├── core
│ │ │ ├── Admin.js
│ │ │ ├── Layout.js
│ │ │ └── Private.js
│ │ └── index.js
│ └── yarn.lock
└── server
│ ├── .DS_Store
│ ├── .gitignore
│ ├── controllers
│ ├── auth.js
│ └── user.js
│ ├── models
│ └── user.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ ├── auth.js
│ └── user.js
│ ├── server.js
│ └── validators
│ ├── auth.js
│ └── index.js
├── Backend
├── .DS_Store
├── .gitignore
├── controllers
│ ├── auth.js
│ └── user.js
├── models
│ └── user.js
├── package-lock.json
├── package.json
├── routes
│ ├── auth.js
│ └── user.js
├── server.js
└── validators
│ ├── auth.js
│ └── index.js
├── Frontend
├── .gitignore
├── README.md
├── build
│ ├── 200.html
│ ├── 404.html
│ ├── asset-manifest.json
│ ├── auth
│ │ └── password
│ │ │ └── forgot
│ │ │ └── index.html
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ ├── precache-manifest.138f9ac05a12b0702198c7618854db1e.js
│ ├── robots.txt
│ ├── service-worker.js
│ ├── signin
│ │ └── index.html
│ ├── signup
│ │ └── index.html
│ └── static
│ │ ├── css
│ │ ├── 2.c829125e.chunk.css
│ │ └── 2.c829125e.chunk.css.map
│ │ └── js
│ │ ├── 2.ac7a2616.chunk.js
│ │ ├── 2.ac7a2616.chunk.js.map
│ │ ├── main.01c89894.chunk.js
│ │ ├── main.01c89894.chunk.js.map
│ │ ├── runtime-main.e077b804.js
│ │ └── runtime-main.e077b804.js.map
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
├── server.js
├── src
│ ├── App.js
│ ├── Routes.js
│ ├── auth
│ │ ├── Activate.js
│ │ ├── AdminRoute.js
│ │ ├── Facebook.js
│ │ ├── Forgot.js
│ │ ├── Google.js
│ │ ├── PrivateRoute.js
│ │ ├── Reset.js
│ │ ├── Signin.js
│ │ ├── Signup.js
│ │ └── helpers.js
│ ├── core
│ │ ├── Admin.js
│ │ ├── Layout.js
│ │ └── Private.js
│ └── index.js
└── yarn.lock
├── LICENSE
├── README.md
└── mern-auth-bundle-master
└── .DS_Store
/04 server setup/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/04 server setup/.DS_Store
--------------------------------------------------------------------------------
/04 server setup/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/04 server setup/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/04 server setup/client/public/favicon.ico
--------------------------------------------------------------------------------
/04 server setup/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/04 server setup/client/public/logo192.png
--------------------------------------------------------------------------------
/04 server setup/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/04 server setup/client/public/logo512.png
--------------------------------------------------------------------------------
/04 server setup/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/04 server setup/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/04 server setup/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/04 server setup/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/04 server setup/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/04 server setup/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/04 server setup/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/04 server setup/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/04 server setup/server/.DS_Store
--------------------------------------------------------------------------------
/04 server setup/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.17.1",
14 | "nodemon": "^1.19.4"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/04 server setup/server/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 |
3 | const app = express();
4 |
5 | app.get('/api/signup', (req, res) => {
6 | res.json({
7 | data: 'you hit signup endpoint'
8 | });
9 | });
10 |
11 | const port = process.env.port || 8000;
12 | app.listen(port, () => {
13 | console.log(`API is running on port ${port}`);
14 | });
15 |
--------------------------------------------------------------------------------
/05 installing npm packages.js:
--------------------------------------------------------------------------------
1 | npm i body-parser cors dotenv express-jwt express-validator google-auth-library jsonwebtoken mongoose morgan @sendgrid/mail
--------------------------------------------------------------------------------
/07 moving to controllers/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/07 moving to controllers/.DS_Store
--------------------------------------------------------------------------------
/07 moving to controllers/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/07 moving to controllers/client/public/favicon.ico
--------------------------------------------------------------------------------
/07 moving to controllers/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/07 moving to controllers/client/public/logo192.png
--------------------------------------------------------------------------------
/07 moving to controllers/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/07 moving to controllers/client/public/logo512.png
--------------------------------------------------------------------------------
/07 moving to controllers/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/07 moving to controllers/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/07 moving to controllers/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/07 moving to controllers/server/.DS_Store
--------------------------------------------------------------------------------
/07 moving to controllers/server/controllers/auth.js:
--------------------------------------------------------------------------------
1 | exports.signup = (req, res) => {
2 | res.json({
3 | data: 'you hit signup endpoint yay from controllers'
4 | });
5 | };
6 |
--------------------------------------------------------------------------------
/07 moving to controllers/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/07 moving to controllers/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | router.get('/signup', signup);
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/07 moving to controllers/server/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 |
3 | const app = express();
4 |
5 | // import routes
6 | const authRoutes = require('./routes/auth');
7 |
8 | // middleware
9 | app.use('/api', authRoutes);
10 |
11 | const port = process.env.port || 8000;
12 | app.listen(port, () => {
13 | console.log(`API is running on port ${port}`);
14 | });
15 |
--------------------------------------------------------------------------------
/08 user model/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/08 user model/.DS_Store
--------------------------------------------------------------------------------
/08 user model/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/08 user model/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/08 user model/client/public/favicon.ico
--------------------------------------------------------------------------------
/08 user model/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/08 user model/client/public/logo192.png
--------------------------------------------------------------------------------
/08 user model/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/08 user model/client/public/logo512.png
--------------------------------------------------------------------------------
/08 user model/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/08 user model/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/08 user model/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/08 user model/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/08 user model/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/08 user model/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/08 user model/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/08 user model/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/08 user model/server/.DS_Store
--------------------------------------------------------------------------------
/08 user model/server/controllers/auth.js:
--------------------------------------------------------------------------------
1 | exports.signup = (req, res) => {
2 | res.json({
3 | data: 'you hit signup endpoint yay from controllers'
4 | });
5 | };
6 |
--------------------------------------------------------------------------------
/08 user model/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/08 user model/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | router.get('/signup', signup);
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/08 user model/server/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 |
3 | const app = express();
4 |
5 | // import routes
6 | const authRoutes = require('./routes/auth');
7 |
8 | // middleware
9 | app.use('/api', authRoutes);
10 |
11 | const port = process.env.port || 8000;
12 | app.listen(port, () => {
13 | console.log(`API is running on port ${port}`);
14 | });
15 |
--------------------------------------------------------------------------------
/09 applying middlewares/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/09 applying middlewares/.DS_Store
--------------------------------------------------------------------------------
/09 applying middlewares/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/09 applying middlewares/client/public/favicon.ico
--------------------------------------------------------------------------------
/09 applying middlewares/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/09 applying middlewares/client/public/logo192.png
--------------------------------------------------------------------------------
/09 applying middlewares/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/09 applying middlewares/client/public/logo512.png
--------------------------------------------------------------------------------
/09 applying middlewares/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/09 applying middlewares/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/09 applying middlewares/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/09 applying middlewares/server/.DS_Store
--------------------------------------------------------------------------------
/09 applying middlewares/server/.env:
--------------------------------------------------------------------------------
1 | NODE_ENV=development
2 | PORT=8000
3 | CLIENT_URL=http://localhost:3000
--------------------------------------------------------------------------------
/09 applying middlewares/server/controllers/auth.js:
--------------------------------------------------------------------------------
1 | exports.signup = (req, res) => {
2 | res.json({
3 | data: 'you hit signup endpoint yay from controllers'
4 | });
5 | };
6 |
--------------------------------------------------------------------------------
/09 applying middlewares/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/09 applying middlewares/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | router.get('/signup', signup);
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/11 connect to mongodb/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/11 connect to mongodb/.DS_Store
--------------------------------------------------------------------------------
/11 connect to mongodb/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/11 connect to mongodb/client/public/favicon.ico
--------------------------------------------------------------------------------
/11 connect to mongodb/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/11 connect to mongodb/client/public/logo192.png
--------------------------------------------------------------------------------
/11 connect to mongodb/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/11 connect to mongodb/client/public/logo512.png
--------------------------------------------------------------------------------
/11 connect to mongodb/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/11 connect to mongodb/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/11 connect to mongodb/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/11 connect to mongodb/server/.DS_Store
--------------------------------------------------------------------------------
/11 connect to mongodb/server/.env:
--------------------------------------------------------------------------------
1 | NODE_ENV=development
2 | PORT=8000
3 | CLIENT_URL=http://localhost:3000
4 | DATABASE='mongodb://localhost:27017/mernauth'
--------------------------------------------------------------------------------
/11 connect to mongodb/server/controllers/auth.js:
--------------------------------------------------------------------------------
1 | exports.signup = (req, res) => {
2 | res.json({
3 | data: 'you hit signup endpoint yay from controllers'
4 | });
5 | };
6 |
--------------------------------------------------------------------------------
/11 connect to mongodb/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/11 connect to mongodb/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | router.get('/signup', signup);
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/12 express validator/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/12 express validator/.DS_Store
--------------------------------------------------------------------------------
/12 express validator/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/12 express validator/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/12 express validator/client/public/favicon.ico
--------------------------------------------------------------------------------
/12 express validator/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/12 express validator/client/public/logo192.png
--------------------------------------------------------------------------------
/12 express validator/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/12 express validator/client/public/logo512.png
--------------------------------------------------------------------------------
/12 express validator/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/12 express validator/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/12 express validator/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/12 express validator/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/12 express validator/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/12 express validator/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/12 express validator/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/12 express validator/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/12 express validator/server/.DS_Store
--------------------------------------------------------------------------------
/12 express validator/server/.env:
--------------------------------------------------------------------------------
1 | NODE_ENV=development
2 | PORT=8000
3 | CLIENT_URL=http://localhost:3000
4 | DATABASE='mongodb://localhost:27017/mernauth'
--------------------------------------------------------------------------------
/12 express validator/server/controllers/auth.js:
--------------------------------------------------------------------------------
1 | exports.signup = (req, res) => {
2 | console.log('REQ BODY ON SIGNUP', req.body);
3 | res.json({
4 | data: 'you hit signup endpoint yay from controllers'
5 | });
6 | };
7 |
--------------------------------------------------------------------------------
/12 express validator/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/12 express validator/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 |
13 | module.exports = router;
14 |
--------------------------------------------------------------------------------
/12 express validator/server/validators/auth.js:
--------------------------------------------------------------------------------
1 | const { check } = require('express-validator');
2 |
3 | exports.userSignupValidator = [
4 | check('name')
5 | .not()
6 | .isEmpty()
7 | .withMessage('Name is required'),
8 | check('email')
9 | .isEmail()
10 | .withMessage('Must be a valid email address'),
11 | check('password')
12 | .isLength({ min: 6 })
13 | .withMessage('Password must be at least 6 characters long')
14 | ];
15 |
--------------------------------------------------------------------------------
/12 express validator/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/13 signup user/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/13 signup user/.DS_Store
--------------------------------------------------------------------------------
/13 signup user/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/13 signup user/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/13 signup user/client/public/favicon.ico
--------------------------------------------------------------------------------
/13 signup user/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/13 signup user/client/public/logo192.png
--------------------------------------------------------------------------------
/13 signup user/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/13 signup user/client/public/logo512.png
--------------------------------------------------------------------------------
/13 signup user/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/13 signup user/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/13 signup user/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/13 signup user/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/13 signup user/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/13 signup user/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/13 signup user/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/13 signup user/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/13 signup user/server/.DS_Store
--------------------------------------------------------------------------------
/13 signup user/server/.env:
--------------------------------------------------------------------------------
1 | NODE_ENV=development
2 | PORT=8000
3 | CLIENT_URL=http://localhost:3000
4 | DATABASE='mongodb://localhost:27017/mernauth'
--------------------------------------------------------------------------------
/13 signup user/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/13 signup user/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 |
13 | module.exports = router;
14 |
--------------------------------------------------------------------------------
/13 signup user/server/validators/auth.js:
--------------------------------------------------------------------------------
1 | const { check } = require('express-validator');
2 |
3 | exports.userSignupValidator = [
4 | check('name')
5 | .not()
6 | .isEmpty()
7 | .withMessage('Name is required'),
8 | check('email')
9 | .isEmail()
10 | .withMessage('Must be a valid email address'),
11 | check('password')
12 | .isLength({ min: 6 })
13 | .withMessage('Password must be at least 6 characters long')
14 | ];
15 |
--------------------------------------------------------------------------------
/13 signup user/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/15 signup with sendgrid/.DS_Store
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/15 signup with sendgrid/client/public/favicon.ico
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/15 signup with sendgrid/client/public/logo192.png
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/15 signup with sendgrid/client/public/logo512.png
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/15 signup with sendgrid/server/.DS_Store
--------------------------------------------------------------------------------
/15 signup with sendgrid/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/15 signup with sendgrid/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 |
13 | module.exports = router;
14 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/server/validators/auth.js:
--------------------------------------------------------------------------------
1 | const { check } = require('express-validator');
2 |
3 | exports.userSignupValidator = [
4 | check('name')
5 | .not()
6 | .isEmpty()
7 | .withMessage('Name is required'),
8 | check('email')
9 | .isEmail()
10 | .withMessage('Must be a valid email address'),
11 | check('password')
12 | .isLength({ min: 6 })
13 | .withMessage('Password must be at least 6 characters long')
14 | ];
15 |
--------------------------------------------------------------------------------
/15 signup with sendgrid/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/16 send email on signup/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/16 send email on signup/.DS_Store
--------------------------------------------------------------------------------
/16 send email on signup/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/16 send email on signup/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/16 send email on signup/client/public/favicon.ico
--------------------------------------------------------------------------------
/16 send email on signup/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/16 send email on signup/client/public/logo192.png
--------------------------------------------------------------------------------
/16 send email on signup/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/16 send email on signup/client/public/logo512.png
--------------------------------------------------------------------------------
/16 send email on signup/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/16 send email on signup/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/16 send email on signup/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/16 send email on signup/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/16 send email on signup/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/16 send email on signup/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/16 send email on signup/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/16 send email on signup/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/16 send email on signup/server/.DS_Store
--------------------------------------------------------------------------------
/16 send email on signup/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/16 send email on signup/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/16 send email on signup/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 |
13 | module.exports = router;
14 |
--------------------------------------------------------------------------------
/16 send email on signup/server/validators/auth.js:
--------------------------------------------------------------------------------
1 | const { check } = require('express-validator');
2 |
3 | exports.userSignupValidator = [
4 | check('name')
5 | .not()
6 | .isEmpty()
7 | .withMessage('Name is required'),
8 | check('email')
9 | .isEmail()
10 | .withMessage('Must be a valid email address'),
11 | check('password')
12 | .isLength({ min: 6 })
13 | .withMessage('Password must be at least 6 characters long')
14 | ];
15 |
--------------------------------------------------------------------------------
/16 send email on signup/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/17 account activation/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/17 account activation/.DS_Store
--------------------------------------------------------------------------------
/17 account activation/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/17 account activation/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/17 account activation/client/public/favicon.ico
--------------------------------------------------------------------------------
/17 account activation/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/17 account activation/client/public/logo192.png
--------------------------------------------------------------------------------
/17 account activation/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/17 account activation/client/public/logo512.png
--------------------------------------------------------------------------------
/17 account activation/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/17 account activation/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/17 account activation/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/17 account activation/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/17 account activation/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/17 account activation/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/17 account activation/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/17 account activation/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/17 account activation/server/.DS_Store
--------------------------------------------------------------------------------
/17 account activation/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/17 account activation/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/17 account activation/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 |
14 | module.exports = router;
15 |
--------------------------------------------------------------------------------
/17 account activation/server/validators/auth.js:
--------------------------------------------------------------------------------
1 | const { check } = require('express-validator');
2 |
3 | exports.userSignupValidator = [
4 | check('name')
5 | .not()
6 | .isEmpty()
7 | .withMessage('Name is required'),
8 | check('email')
9 | .isEmail()
10 | .withMessage('Must be a valid email address'),
11 | check('password')
12 | .isLength({ min: 6 })
13 | .withMessage('Password must be at least 6 characters long')
14 | ];
15 |
--------------------------------------------------------------------------------
/17 account activation/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/18 user signin/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/18 user signin/.DS_Store
--------------------------------------------------------------------------------
/18 user signin/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/18 user signin/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/18 user signin/client/public/favicon.ico
--------------------------------------------------------------------------------
/18 user signin/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/18 user signin/client/public/logo192.png
--------------------------------------------------------------------------------
/18 user signin/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/18 user signin/client/public/logo512.png
--------------------------------------------------------------------------------
/18 user signin/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/18 user signin/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/18 user signin/client/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | }
8 |
9 | .App-header {
10 | background-color: #282c34;
11 | min-height: 100vh;
12 | display: flex;
13 | flex-direction: column;
14 | align-items: center;
15 | justify-content: center;
16 | font-size: calc(10px + 2vmin);
17 | color: white;
18 | }
19 |
20 | .App-link {
21 | color: #09d3ac;
22 | }
23 |
--------------------------------------------------------------------------------
/18 user signin/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/18 user signin/client/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/18 user signin/client/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/18 user signin/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/18 user signin/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/18 user signin/server/.DS_Store
--------------------------------------------------------------------------------
/18 user signin/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/18 user signin/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/18 user signin/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/18 user signin/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/24 finishing signup/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/24 finishing signup/.DS_Store
--------------------------------------------------------------------------------
/24 finishing signup/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/24 finishing signup/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/24 finishing signup/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/24 finishing signup/client/public/favicon.ico
--------------------------------------------------------------------------------
/24 finishing signup/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/24 finishing signup/client/public/logo192.png
--------------------------------------------------------------------------------
/24 finishing signup/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/24 finishing signup/client/public/logo512.png
--------------------------------------------------------------------------------
/24 finishing signup/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/24 finishing signup/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/24 finishing signup/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/24 finishing signup/client/src/Routes.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { BrowserRouter, Switch, Route } from 'react-router-dom';
3 | import App from './App';
4 | import Signup from './auth/Signup';
5 |
6 | const Routes = () => {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 | );
15 | };
16 |
17 | export default Routes;
18 |
--------------------------------------------------------------------------------
/24 finishing signup/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/24 finishing signup/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/24 finishing signup/server/.DS_Store
--------------------------------------------------------------------------------
/24 finishing signup/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/24 finishing signup/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/24 finishing signup/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/24 finishing signup/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/26 activate account/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/26 activate account/.DS_Store
--------------------------------------------------------------------------------
/26 activate account/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/26 activate account/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/26 activate account/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/26 activate account/client/public/favicon.ico
--------------------------------------------------------------------------------
/26 activate account/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/26 activate account/client/public/logo192.png
--------------------------------------------------------------------------------
/26 activate account/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/26 activate account/client/public/logo512.png
--------------------------------------------------------------------------------
/26 activate account/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/26 activate account/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/26 activate account/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/26 activate account/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/26 activate account/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/26 activate account/server/.DS_Store
--------------------------------------------------------------------------------
/26 activate account/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/26 activate account/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/26 activate account/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/26 activate account/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/28 auth helpers/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/28 auth helpers/.DS_Store
--------------------------------------------------------------------------------
/28 auth helpers/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/28 auth helpers/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/28 auth helpers/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/28 auth helpers/client/public/favicon.ico
--------------------------------------------------------------------------------
/28 auth helpers/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/28 auth helpers/client/public/logo192.png
--------------------------------------------------------------------------------
/28 auth helpers/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/28 auth helpers/client/public/logo512.png
--------------------------------------------------------------------------------
/28 auth helpers/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/28 auth helpers/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/28 auth helpers/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/28 auth helpers/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/28 auth helpers/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/28 auth helpers/server/.DS_Store
--------------------------------------------------------------------------------
/28 auth helpers/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/28 auth helpers/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/28 auth helpers/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/28 auth helpers/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/29 authenticate and signout/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/29 authenticate and signout/.DS_Store
--------------------------------------------------------------------------------
/29 authenticate and signout/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/29 authenticate and signout/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/29 authenticate and signout/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/29 authenticate and signout/client/public/favicon.ico
--------------------------------------------------------------------------------
/29 authenticate and signout/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/29 authenticate and signout/client/public/logo192.png
--------------------------------------------------------------------------------
/29 authenticate and signout/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/29 authenticate and signout/client/public/logo512.png
--------------------------------------------------------------------------------
/29 authenticate and signout/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/29 authenticate and signout/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/29 authenticate and signout/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/29 authenticate and signout/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/29 authenticate and signout/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/29 authenticate and signout/server/.DS_Store
--------------------------------------------------------------------------------
/29 authenticate and signout/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/29 authenticate and signout/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/29 authenticate and signout/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/29 authenticate and signout/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/34 protect api endpoint/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/34 protect api endpoint/.DS_Store
--------------------------------------------------------------------------------
/34 protect api endpoint/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/34 protect api endpoint/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/34 protect api endpoint/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/34 protect api endpoint/client/public/favicon.ico
--------------------------------------------------------------------------------
/34 protect api endpoint/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/34 protect api endpoint/client/public/logo192.png
--------------------------------------------------------------------------------
/34 protect api endpoint/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/34 protect api endpoint/client/public/logo512.png
--------------------------------------------------------------------------------
/34 protect api endpoint/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/34 protect api endpoint/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/34 protect api endpoint/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/34 protect api endpoint/client/src/core/Admin.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Admin = () => (
5 |
6 | Admin page
7 |
8 | );
9 |
10 | export default Admin;
11 |
--------------------------------------------------------------------------------
/34 protect api endpoint/client/src/core/Private.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Private = () => (
5 |
6 | Private page
7 |
8 | );
9 |
10 | export default Private;
11 |
--------------------------------------------------------------------------------
/34 protect api endpoint/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/34 protect api endpoint/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/34 protect api endpoint/server/.DS_Store
--------------------------------------------------------------------------------
/34 protect api endpoint/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/34 protect api endpoint/server/controllers/user.js:
--------------------------------------------------------------------------------
1 | const User = require('../models/user');
2 |
3 | exports.read = (req, res) => {
4 | const userId = req.params.id;
5 | User.findById(userId).exec((err, user) => {
6 | if (err || !user) {
7 | return res.status(400).json({
8 | error: 'User not found'
9 | });
10 | }
11 | user.hashed_password = undefined;
12 | user.salt = undefined;
13 | res.json(user);
14 | });
15 | };
16 |
--------------------------------------------------------------------------------
/34 protect api endpoint/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/34 protect api endpoint/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/34 protect api endpoint/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin } = require('../controllers/auth');
6 | const { read } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 |
10 | module.exports = router;
11 |
--------------------------------------------------------------------------------
/34 protect api endpoint/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/36 admin middleware/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/36 admin middleware/.DS_Store
--------------------------------------------------------------------------------
/36 admin middleware/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/36 admin middleware/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/36 admin middleware/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/36 admin middleware/client/public/favicon.ico
--------------------------------------------------------------------------------
/36 admin middleware/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/36 admin middleware/client/public/logo192.png
--------------------------------------------------------------------------------
/36 admin middleware/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/36 admin middleware/client/public/logo512.png
--------------------------------------------------------------------------------
/36 admin middleware/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/36 admin middleware/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/36 admin middleware/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/36 admin middleware/client/src/core/Admin.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Admin = () => (
5 |
6 | Admin page
7 |
8 | );
9 |
10 | export default Admin;
11 |
--------------------------------------------------------------------------------
/36 admin middleware/client/src/core/Private.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Private = () => (
5 |
6 | Private page
7 |
8 | );
9 |
10 | export default Private;
11 |
--------------------------------------------------------------------------------
/36 admin middleware/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/36 admin middleware/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/36 admin middleware/server/.DS_Store
--------------------------------------------------------------------------------
/36 admin middleware/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/36 admin middleware/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/36 admin middleware/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/36 admin middleware/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/36 admin middleware/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/37 profile update page setup/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/37 profile update page setup/.DS_Store
--------------------------------------------------------------------------------
/37 profile update page setup/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/37 profile update page setup/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/37 profile update page setup/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/37 profile update page setup/client/public/favicon.ico
--------------------------------------------------------------------------------
/37 profile update page setup/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/37 profile update page setup/client/public/logo192.png
--------------------------------------------------------------------------------
/37 profile update page setup/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/37 profile update page setup/client/public/logo512.png
--------------------------------------------------------------------------------
/37 profile update page setup/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/37 profile update page setup/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/37 profile update page setup/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/37 profile update page setup/client/src/core/Admin.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Admin = () => (
5 |
6 | Admin page
7 |
8 | );
9 |
10 | export default Admin;
11 |
--------------------------------------------------------------------------------
/37 profile update page setup/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/37 profile update page setup/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/37 profile update page setup/server/.DS_Store
--------------------------------------------------------------------------------
/37 profile update page setup/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/37 profile update page setup/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/37 profile update page setup/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/37 profile update page setup/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/38 errors cleanup/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/38 errors cleanup/.DS_Store
--------------------------------------------------------------------------------
/38 errors cleanup/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/38 errors cleanup/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/38 errors cleanup/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/38 errors cleanup/client/public/favicon.ico
--------------------------------------------------------------------------------
/38 errors cleanup/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/38 errors cleanup/client/public/logo192.png
--------------------------------------------------------------------------------
/38 errors cleanup/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/38 errors cleanup/client/public/logo512.png
--------------------------------------------------------------------------------
/38 errors cleanup/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/38 errors cleanup/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/38 errors cleanup/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/38 errors cleanup/client/src/core/Admin.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Admin = () => (
5 |
6 | Admin page
7 |
8 | );
9 |
10 | export default Admin;
11 |
--------------------------------------------------------------------------------
/38 errors cleanup/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/38 errors cleanup/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/38 errors cleanup/server/.DS_Store
--------------------------------------------------------------------------------
/38 errors cleanup/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/38 errors cleanup/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/38 errors cleanup/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/38 errors cleanup/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/38 errors cleanup/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/39 pre-populate profile update and handle jwt expiry/.DS_Store
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/39 pre-populate profile update and handle jwt expiry/client/public/favicon.ico
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/39 pre-populate profile update and handle jwt expiry/client/public/logo192.png
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/39 pre-populate profile update and handle jwt expiry/client/public/logo512.png
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/src/core/Admin.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from '../core/Layout';
3 |
4 | const Admin = () => (
5 |
6 | Admin page
7 |
8 | );
9 |
10 | export default Admin;
11 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/39 pre-populate profile update and handle jwt expiry/server/.DS_Store
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/39 pre-populate profile update and handle jwt expiry/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/41 admin profile update/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/41 admin profile update/.DS_Store
--------------------------------------------------------------------------------
/41 admin profile update/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/41 admin profile update/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/41 admin profile update/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/41 admin profile update/client/public/favicon.ico
--------------------------------------------------------------------------------
/41 admin profile update/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/41 admin profile update/client/public/logo192.png
--------------------------------------------------------------------------------
/41 admin profile update/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/41 admin profile update/client/public/logo512.png
--------------------------------------------------------------------------------
/41 admin profile update/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/41 admin profile update/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/41 admin profile update/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/41 admin profile update/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/41 admin profile update/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/41 admin profile update/server/.DS_Store
--------------------------------------------------------------------------------
/41 admin profile update/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/41 admin profile update/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/41 admin profile update/server/routes/auth.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { signup, accountActivation, signin } = require('../controllers/auth');
6 |
7 | // import validators
8 | const { userSignupValidator, userSigninValidator } = require('../validators/auth');
9 | const { runValidation } = require('../validators');
10 |
11 | router.post('/signup', userSignupValidator, runValidation, signup);
12 | router.post('/account-activation', accountActivation);
13 | router.post('/signin', userSigninValidator, runValidation, signin);
14 |
15 | module.exports = router;
16 |
--------------------------------------------------------------------------------
/41 admin profile update/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/41 admin profile update/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/42 forgot password server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/42 forgot password server/.DS_Store
--------------------------------------------------------------------------------
/42 forgot password server/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/42 forgot password server/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/42 forgot password server/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/42 forgot password server/client/public/favicon.ico
--------------------------------------------------------------------------------
/42 forgot password server/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/42 forgot password server/client/public/logo192.png
--------------------------------------------------------------------------------
/42 forgot password server/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/42 forgot password server/client/public/logo512.png
--------------------------------------------------------------------------------
/42 forgot password server/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/42 forgot password server/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/42 forgot password server/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/42 forgot password server/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/42 forgot password server/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/42 forgot password server/server/.DS_Store
--------------------------------------------------------------------------------
/42 forgot password server/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/42 forgot password server/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/42 forgot password server/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/43 reset password server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/43 reset password server/.DS_Store
--------------------------------------------------------------------------------
/43 reset password server/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/43 reset password server/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/43 reset password server/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/43 reset password server/client/public/favicon.ico
--------------------------------------------------------------------------------
/43 reset password server/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/43 reset password server/client/public/logo192.png
--------------------------------------------------------------------------------
/43 reset password server/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/43 reset password server/client/public/logo512.png
--------------------------------------------------------------------------------
/43 reset password server/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/43 reset password server/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/43 reset password server/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/43 reset password server/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/43 reset password server/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/43 reset password server/server/.DS_Store
--------------------------------------------------------------------------------
/43 reset password server/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/43 reset password server/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/43 reset password server/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/44 forgot password client/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/44 forgot password client/.DS_Store
--------------------------------------------------------------------------------
/44 forgot password client/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/44 forgot password client/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/44 forgot password client/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/44 forgot password client/client/public/favicon.ico
--------------------------------------------------------------------------------
/44 forgot password client/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/44 forgot password client/client/public/logo192.png
--------------------------------------------------------------------------------
/44 forgot password client/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/44 forgot password client/client/public/logo512.png
--------------------------------------------------------------------------------
/44 forgot password client/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/44 forgot password client/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/44 forgot password client/client/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Layout from './core/Layout';
3 |
4 | const App = () => {
5 | return (
6 |
7 | Hello React
8 |
9 | );
10 | };
11 |
12 | export default App;
13 |
--------------------------------------------------------------------------------
/44 forgot password client/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/44 forgot password client/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/44 forgot password client/server/.DS_Store
--------------------------------------------------------------------------------
/44 forgot password client/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/44 forgot password client/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/44 forgot password client/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/45 reset password client/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/45 reset password client/.DS_Store
--------------------------------------------------------------------------------
/45 reset password client/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
--------------------------------------------------------------------------------
/45 reset password client/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/45 reset password client/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/45 reset password client/client/public/favicon.ico
--------------------------------------------------------------------------------
/45 reset password client/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/45 reset password client/client/public/logo192.png
--------------------------------------------------------------------------------
/45 reset password client/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/45 reset password client/client/public/logo512.png
--------------------------------------------------------------------------------
/45 reset password client/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/45 reset password client/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/45 reset password client/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/45 reset password client/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/45 reset password client/server/.DS_Store
--------------------------------------------------------------------------------
/45 reset password client/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/45 reset password client/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/45 reset password client/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/47 google login server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/47 google login server/.DS_Store
--------------------------------------------------------------------------------
/47 google login server/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
2 | REACT_APP_GOOGLE_CLIENT_ID=823672806879-o018fdkkgsoenue0bj8l8gi3nnge1b2s.apps.googleusercontent.com
--------------------------------------------------------------------------------
/47 google login server/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/47 google login server/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/47 google login server/client/public/favicon.ico
--------------------------------------------------------------------------------
/47 google login server/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/47 google login server/client/public/logo192.png
--------------------------------------------------------------------------------
/47 google login server/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/47 google login server/client/public/logo512.png
--------------------------------------------------------------------------------
/47 google login server/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/47 google login server/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/47 google login server/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/47 google login server/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/47 google login server/server/.DS_Store
--------------------------------------------------------------------------------
/47 google login server/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/47 google login server/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon server.js"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@sendgrid/mail": "^6.4.0",
14 | "body-parser": "^1.19.0",
15 | "cors": "^2.8.5",
16 | "dotenv": "^8.2.0",
17 | "express": "^4.17.1",
18 | "express-jwt": "^5.3.1",
19 | "express-validator": "^6.2.0",
20 | "google-auth-library": "^5.5.1",
21 | "jsonwebtoken": "^8.5.1",
22 | "mongoose": "^5.7.7",
23 | "morgan": "^1.9.1",
24 | "nodemon": "^1.19.4"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/47 google login server/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/47 google login server/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/48 login with facebook client/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/48 login with facebook client/.DS_Store
--------------------------------------------------------------------------------
/48 login with facebook client/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
2 | REACT_APP_GOOGLE_CLIENT_ID=823672806879-o018fdkkgsoenue0bj8l8gi3nnge1b2s.apps.googleusercontent.com
3 | REACT_APP_FACEBOOK_APP_ID=404978217072020
--------------------------------------------------------------------------------
/48 login with facebook client/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/48 login with facebook client/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/48 login with facebook client/client/public/favicon.ico
--------------------------------------------------------------------------------
/48 login with facebook client/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/48 login with facebook client/client/public/logo192.png
--------------------------------------------------------------------------------
/48 login with facebook client/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/48 login with facebook client/client/public/logo512.png
--------------------------------------------------------------------------------
/48 login with facebook client/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/48 login with facebook client/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/48 login with facebook client/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/48 login with facebook client/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/48 login with facebook client/server/.DS_Store
--------------------------------------------------------------------------------
/48 login with facebook client/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/48 login with facebook client/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/48 login with facebook client/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/49 login with facebook server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/49 login with facebook server/.DS_Store
--------------------------------------------------------------------------------
/49 login with facebook server/client/.env:
--------------------------------------------------------------------------------
1 | REACT_APP_API=http://localhost:8000/api
2 | REACT_APP_GOOGLE_CLIENT_ID=823672806879-o018fdkkgsoenue0bj8l8gi3nnge1b2s.apps.googleusercontent.com
3 | REACT_APP_FACEBOOK_APP_ID=404978217072020
--------------------------------------------------------------------------------
/49 login with facebook server/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/49 login with facebook server/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/49 login with facebook server/client/public/favicon.ico
--------------------------------------------------------------------------------
/49 login with facebook server/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/49 login with facebook server/client/public/logo192.png
--------------------------------------------------------------------------------
/49 login with facebook server/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/49 login with facebook server/client/public/logo512.png
--------------------------------------------------------------------------------
/49 login with facebook server/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/49 login with facebook server/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/49 login with facebook server/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/49 login with facebook server/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/49 login with facebook server/server/.DS_Store
--------------------------------------------------------------------------------
/49 login with facebook server/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/49 login with facebook server/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/49 login with facebook server/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/51 getting ready for production/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/51 getting ready for production/.DS_Store
--------------------------------------------------------------------------------
/51 getting ready for production/client/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .env
16 | .DS_Store
17 | .env.local
18 | .env.development.local
19 | .env.test.local
20 | .env.production.local
21 |
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
--------------------------------------------------------------------------------
/51 getting ready for production/client/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/51 getting ready for production/client/public/favicon.ico
--------------------------------------------------------------------------------
/51 getting ready for production/client/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/51 getting ready for production/client/public/logo192.png
--------------------------------------------------------------------------------
/51 getting ready for production/client/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/51 getting ready for production/client/public/logo512.png
--------------------------------------------------------------------------------
/51 getting ready for production/client/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/51 getting ready for production/client/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/51 getting ready for production/client/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const compression = require('compression');
3 | const path = require('path');
4 | const app = express();
5 |
6 | app.use(compression());
7 | app.use(express.static(path.join(__dirname, 'build')));
8 |
9 | app.get('*', function(req, res) {
10 | res.sendFile(path.join(__dirname, 'build', 'index.html'));
11 | });
12 |
13 | const PORT = process.env.PORT || 3000;
14 |
15 | app.listen(PORT, () => {
16 | console.log(`App is running on port ${PORT}`);
17 | });
18 |
--------------------------------------------------------------------------------
/51 getting ready for production/client/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import Routes from './Routes';
4 |
5 | ReactDOM.render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/51 getting ready for production/server/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/51 getting ready for production/server/.DS_Store
--------------------------------------------------------------------------------
/51 getting ready for production/server/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/51 getting ready for production/server/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/51 getting ready for production/server/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/Backend/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Backend/.DS_Store
--------------------------------------------------------------------------------
/Backend/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .env
--------------------------------------------------------------------------------
/Backend/routes/user.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const router = express.Router();
3 |
4 | // import controller
5 | const { requireSignin, adminMiddleware } = require('../controllers/auth');
6 | const { read, update } = require('../controllers/user');
7 |
8 | router.get('/user/:id', requireSignin, read);
9 | router.put('/user/update', requireSignin, update);
10 | router.put('/admin/update', requireSignin, adminMiddleware, update);
11 |
12 | module.exports = router;
13 |
--------------------------------------------------------------------------------
/Backend/validators/index.js:
--------------------------------------------------------------------------------
1 | const { validationResult } = require('express-validator');
2 |
3 | exports.runValidation = (req, res, next) => {
4 | const errors = validationResult(req);
5 | if (!errors.isEmpty()) {
6 | return res.status(422).json({
7 | error: errors.array()[0].msg
8 | });
9 | }
10 | next();
11 | };
12 |
--------------------------------------------------------------------------------
/Frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 |
13 | # misc
14 | .env
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/Frontend/build/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Frontend/build/favicon.ico
--------------------------------------------------------------------------------
/Frontend/build/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Frontend/build/logo192.png
--------------------------------------------------------------------------------
/Frontend/build/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Frontend/build/logo512.png
--------------------------------------------------------------------------------
/Frontend/build/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/Frontend/build/precache-manifest.138f9ac05a12b0702198c7618854db1e.js:
--------------------------------------------------------------------------------
1 | self.__precacheManifest = (self.__precacheManifest || []).concat([
2 | {
3 | "revision": "90aba8b13783cf62faa2b7b82f966670",
4 | "url": "/index.html"
5 | },
6 | {
7 | "revision": "3fea8c204a9e97220a74",
8 | "url": "/static/css/2.c829125e.chunk.css"
9 | },
10 | {
11 | "revision": "3fea8c204a9e97220a74",
12 | "url": "/static/js/2.ac7a2616.chunk.js"
13 | },
14 | {
15 | "revision": "a134827466c0a363a351",
16 | "url": "/static/js/main.01c89894.chunk.js"
17 | },
18 | {
19 | "revision": "875d570ce1b6fc43afc6",
20 | "url": "/static/js/runtime-main.e077b804.js"
21 | }
22 | ]);
--------------------------------------------------------------------------------
/Frontend/build/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/Frontend/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Frontend/public/favicon.ico
--------------------------------------------------------------------------------
/Frontend/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Frontend/public/logo192.png
--------------------------------------------------------------------------------
/Frontend/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/Frontend/public/logo512.png
--------------------------------------------------------------------------------
/Frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/Frontend/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/Frontend/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const compression = require('compression');
3 | const path = require('path');
4 | const app = express();
5 |
6 | app.use(compression());
7 | app.use(express.static(path.join(__dirname, 'build')));
8 |
9 | app.get('*', function(req, res) {
10 | res.sendFile(path.join(__dirname, 'build', 'index.html'));
11 | });
12 |
13 | const PORT = process.env.PORT || 3000;
14 |
15 | app.listen(PORT, () => {
16 | console.log(`App is running on port ${PORT}`);
17 | });
18 |
--------------------------------------------------------------------------------
/Frontend/src/index.js:
--------------------------------------------------------------------------------
1 | // import React from 'react';
2 | // import ReactDOM from 'react-dom';
3 | // import Routes from './Routes';
4 |
5 | // ReactDOM.render(, document.getElementById('root'));
6 |
7 | import React from 'react';
8 | import ReactDOM, { hydrate, render } from 'react-dom';
9 | import Routes from './Routes';
10 |
11 | const rootElement = document.getElementById('root');
12 | if (rootElement.hasChildNodes()) {
13 | hydrate(, rootElement);
14 | } else {
15 | render(, rootElement);
16 | }
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # MERN-Stack-Web-Development-with-Ultimate-Authentication
5 | MERN Stack Web Development with Ultimate Authentication by Packt Publishing
6 |
--------------------------------------------------------------------------------
/mern-auth-bundle-master/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PacktPublishing/MERN-Stack-Web-Development-with-Ultimate-Authentication/899dfd373497b0c4fa5f0b7b40114587967b7e58/mern-auth-bundle-master/.DS_Store
--------------------------------------------------------------------------------