A boilerplate React project equiped with Material UI. Bootstrapped with Create React App.
Navigate to the project's root directory and run:
npm install
Create any of these .env
files:
ENV File | Description |
---|---|
.env | Default |
.env.local | Loaded for all environments except test |
.env.development | Loaded on npm start |
.env.production | Loaded on npm run build |
.env.test | Loaded on npm test |
Add these environment variables and replace their corresponding values:
REACT_APP_NAME=React Starter
REACT_APP_API_BASE=http://localhost:8000/api/v1
REACT_APP_SESSION_KEY=react-starter-session
Expected response body structure from login
request
{
"user": {
"name": "John Doe",
"email": "john.doe@email.com",
"roles": [
{
"id": 1,
"name": "Admin",
}
]
},
"token": ""
}
- The
user
object must have aroles
property which contains an array of roles. Roles must be mapped onsrc\common\utils\roles.js
. - The
token
property's value will be automatically attached to theAuthorization
header of every HTTP request.
Runs the app in the development mode.
Launches the test runner in the interactive watch mode.
Builds the app for production to the build
folder.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Identify issues on all js
and jsx
files in the src
directory.
Format the code style of all relevant files in the src
directory.