Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/absphreak/mern-auth
:closed_lock_with_key: MERN authentication flow
https://github.com/absphreak/mern-auth
Last synced: about 1 month ago
JSON representation
:closed_lock_with_key: MERN authentication flow
- Host: GitHub
- URL: https://github.com/absphreak/mern-auth
- Owner: ABSphreak
- License: mit
- Created: 2020-07-24T13:47:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-05T07:41:47.000Z (over 1 year ago)
- Last Synced: 2024-05-21T00:45:38.727Z (6 months ago)
- Language: JavaScript
- Size: 506 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
MERN Authentication/Authorization
:closed_lock_with_key: MERN authentication & authorization flow using a simple TODO app!## Using Application
### Prerequisites
1. Clone this repository.
```shell
git clone https://github.com/ABSphreak/mern-auth.git
```
2. Install all the dependencies in `root` & `client` folder.
```shell
npm install
cd client
npm install
```
3. Create a `.env` in `root` folder.
These environment variables are required:
- `PORT` → Mention a custom port for running the Express server (default is 5000).
- `MONGO_URI` → Put your MONGO_DB connection string here.
- `JWT_SECRET` → Put anything you like, it will be used for `auth_token` validation.
- Format:
```shell
PORT=6969
MONGO_URI=mongodb+srv://:@-onltw.mongodb.net/?retryWrites=true&w=majority
JWT_SECRET=RandomTextString
```### Scripts Available
#### ⫸ `root` (backend)
1. `npm run dev` → Runs the server in development mode.
_(Highly recommended if you want to tweak API)_
- Uses `nodemon` to monitor changes to the API.
- Uses `morgan` to log the request data.
2. `npm start` → Runs the server in production mode.
_(Mostly going to be used for deployment to cloud)_#### ⫸ `client` (frontend)
1. `npm start` → Invokes `react-scripts start`.
2. `npm build` → Invokes `react-scripts build`.
3. `npm test` → Invokes `react-scripts test`.
4. `npm eject` → Invokes `react-scripts eject`.### Branches
For now there are two ongoing branches:
1. `master` → Has the Bootstrap based client application.
2. `material-ui` → Has MaterialUI based client application.More info coming soon!