π MERN authentication & authorization flow using a simple TODO app! MERN Authentication/Authorization
Using Application
Prerequisites
- Clone this repository.
git clone https://github.com/ABSphreak/mern-auth.git
- Install all the dependencies in
root
&client
folder.npm install cd client npm install
- Create a
.env
inroot
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 forauth_token
validation.- Format:
PORT=6969 MONGO_URI=mongodb+srv://<user>:<pwd>@<cluster>-onltw.mongodb.net/<collection_name>?retryWrites=true&w=majority JWT_SECRET=RandomTextString
Scripts Available
root
(backend)
β«Έ 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.
- Uses
npm start
β Runs the server in production mode.
(Mostly going to be used for deployment to cloud)
client
(frontend)
β«Έ npm start
β Invokesreact-scripts start
.npm build
β Invokesreact-scripts build
.npm test
β Invokesreact-scripts test
.npm eject
β Invokesreact-scripts eject
.
Branches
For now there are two ongoing branches:
master
β Has the Bootstrap based client application.material-ui
β Has MaterialUI based client application.
More info coming soon!