Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ugurctaygun/mern-contact-keeper
https://github.com/ugurctaygun/mern-contact-keeper
Last synced: about 8 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/ugurctaygun/mern-contact-keeper
- Owner: ugurctaygun
- Created: 2020-03-04T20:35:28.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T15:36:38.000Z (almost 2 years ago)
- Last Synced: 2023-03-08T03:27:05.383Z (over 1 year ago)
- Language: JavaScript
- Size: 747 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mern-contact-keeper
Tutorial Projectnpm init -y
npm i express bcryptjs jsonwebtoken config express-validator mongoose
npm i -D nodemon concurrently
npm run server
"dev": "concurrently \"npm run server\" \"npm run client\"" at package.json to run client and server concurrently
MONGOOSE
Create models for keeping the schemas of database, userSchema (user: type:string etc)
Export models through route using require();EXPRESS
Create a config file of db, introduce your database variables there and call your database to Server.js
and call it as a method to initiate.Express-js-validator is used to limit the scope of the data that can be sent to the api
Authentication
Create a middleware function to check if the use has the required token to access the private routes.
See middleware/auth.js - routes/auth.jsJWT Web Token
Used to create a unique web token for users.
routes/users.js
jwt.ioBCRYPT
is used to hash the password or objects that are required to be hashed while passing them to the database
bcrypt.hash(param, method);