Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env

This file was deleted.

2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_BASE_URL_STATE=http://localhost:3001/
REACT_APP_BASE_URL_PATH=api
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_BASE_URL_STATE=/
REACT_APP_BASE_URL_PATH=api
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,41 +29,41 @@
- `npx create-react-app PROJECT_NAME --template ui5-webcomponents-react-seed`;
- cd into `PROJECT_NAME`;
- (no need to run `yarn install` since it already installs it for you);
- run the available scripts;
- run the available scripts.

PS.: It is important to add the `--template ui5-webcomponents-react-seed` at the end to get our template.

# Configuration Included

- JEST Up & Runnning.
- JEST Up & Runnning;

- ESLint & EditorConfig Up & Running.
- ESLint & EditorConfig Up & Running;

- CommitLint Up & Running.
- CommitLint Up & Running;

- Enviroment Variables Up & Running.
- Enviroment Variables Up & Running;

- Internalization Up & Running.
- Internalization Up & Running;

- PR Template.
- PR Template;

- IE Support.
- IE Support;

- Multiple Scripts.

# Engine Included

- Fallback Engine (`<ErrorBoundary />`, `<NotFound />` and `<Error />`).
- Fallback Engine (`<ErrorBoundary />`, `<NotFound />` and `<Error />`);

- MockServer Engine (w/ `json-server`).
- MockServer Engine (w/ `json-server`);

- HTTP Request Engine (w/ `Request` and `URLProvider`).
- HTTP Request Engine (w/ `Request` and `URLProvider`);

- Permission Engine (w/ `RouteValidator` and `ComponentValidator`)
- Permission Engine (w/ `RouteValidator` and `ComponentValidator`).

# Hooks Included

- `useRequest`: Which includes `get`, `post`, `patch`, `delete`, `put` HTTP helpers.
- `useRequest`: Which includes `get`, `post`, `patch`, `delete`, `put` HTTP helpers;

- `useAuthority`: Which includes `hasAccess` helpers.

Expand All @@ -75,7 +75,9 @@ In the project directory, you can run:

### `yarn start`

Runs the app in the development mode @ [http://localhost:3000](http://localhost:3000) (⚠️ currently not supported).
Runs the app in the development mode @ [http://localhost:3000](http://localhost:3000).

⚠️ It requires an AppRouter or a BackEnd up & running @ `<domain>:<port>/api`.

### `yarn mock`

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
},
"scripts": {
"build": "react-scripts build",
"mock": "env-cmd -f .env npm-run-all --parallel start:mock start:react",
"start": "env-cmd -f .env npm-run-all --parallel start:react",
"mock": "env-cmd -f .env.development npm-run-all --parallel start:mock start:react",
"start": "env-cmd -f .env.production npm-run-all --parallel start:react",
"start:react": "react-scripts start",
"start:mock": "nodemon --watch server/data --exec npx json-server --p 3001 server/mockserver.js --routes server/routes.json",
"test": "react-scripts test --silent --env=jest-environment-jsdom-sixteen",
Expand Down
2 changes: 1 addition & 1 deletion src/util/Request.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';

const Request = axios.create({
baseURL: process.env.REACT_APP_API_URL,
baseURL: process.env.REACT_APP_BASE_URL_STATE + process.env.REACT_APP_BASE_URL_PATH,
});

export default Request;
4 changes: 2 additions & 2 deletions template.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
},
"scripts": {
"build": "react-scripts build",
"mock": "env-cmd -f .env npm-run-all --parallel start:mock start:react",
"start": "env-cmd -f .env npm-run-all --parallel start:react",
"mock": "env-cmd -f .env.development npm-run-all --parallel start:mock start:react",
"start": "env-cmd -f .env.production npm-run-all --parallel start:react",
"start:react": "react-scripts start",
"start:mock": "nodemon --watch server/data --exec npx json-server --p 3001 server/mockserver.js --routes server/routes.json",
"test": "react-scripts test --silent --env=jest-environment-jsdom-sixteen",
Expand Down