You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-17Lines changed: 29 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -110,25 +110,30 @@ Alternatively run the 'uploadfs' target:
110
110
platformio run -t uploadfs
111
111
```
112
112
113
-
### Running the interface locally
113
+
### Developing the interface locally
114
114
115
-
You can run a development server locally to allow you preview changes to the front end without the need to upload a file system image to the device after each change.
115
+
UI development is an iterative process so it's best to run a development server locally during interface development (using `npm start`). This can be accomplished by deploying the backend to a device and configuring the interface to point to it:
116
116
117
-
Change to the ['interface'](interface) directory with your bash shell (or Git Bash) and use the standard commands you would with any react app built with create-react-app:
The following steps can get you up and running for local interface development:
122
120
123
-
Install the npm dependencies, if required and start the development server:
121
+
-[Enable CORS](#enabling-cors) in platformio.ini
122
+
- Deploy firmware to device
123
+
-[Configure endpoint root](#configuring-the-endpoint-root) with device's IP in interface/.env.development
124
+
-[Start the development server](#starting-the-development-server) with "npm start"
125
+
- Develop interface locally
124
126
125
-
```bash
126
-
npm install
127
-
npm start
127
+
#### Enabling CORS
128
+
129
+
You can enable CORS on the back end by uncommenting the -D ENABLE_CORS build flag in ['platformio.ini'](platformio.ini) then re-building and uploading the firmware to the device. The default settings assume you will be accessing the development server on the default port on [http://localhost:3000](http://localhost:3000) this can also be changed if required:
130
+
131
+
```ini
132
+
-D ENABLE_CORS
133
+
-D CORS_ORIGIN=\"http://localhost:3000\"
128
134
```
129
-
> **Tip**: You can (optionally) speed up the build by commenting out the call to build_interface.py under "extra scripts" during local development. This will prevent the npm process from building the production release every time the firmware is compiled significantly decreasing the build time.
130
135
131
-
#### Changing the endpoint root
136
+
#### Configuring the endpoint root
132
137
133
138
The interface has a development environment which is enabled when running the development server using `npm start`. The environment file can be found in ['interface/.env.development'](interface/.env.development) and contains the HTTP root URL and the WebSocket root URL:
134
139
@@ -141,15 +146,22 @@ The `REACT_APP_HTTP_ROOT` and `REACT_APP_WEB_SOCKET_ROOT` properties can be modi
141
146
142
147
> **Tip**: You must restart the development server for changes to the environment file to come into effect.
143
148
144
-
#### Enabling CORS
149
+
#### Starting the development server
145
150
146
-
You can enable CORS on the back end by uncommenting the -D ENABLE_CORS build flag in ['platformio.ini'](platformio.ini) then re-building and uploading the firmware to the device. The default settings assume you will be accessing the development server on the default port on [http://localhost:3000](http://localhost:3000) this can also be changed if required:
151
+
Change to the ['interface'](interface) directory with your bash shell (or Git Bash) and use the standard commands you would with any react app built with create-react-app:
147
152
148
-
```ini
149
-
-D ENABLE_CORS
150
-
-D CORS_ORIGIN=\"http://localhost:3000\"
153
+
```bash
154
+
cd interface
151
155
```
152
156
157
+
Install the npm dependencies, if required and start the development server:
158
+
159
+
```bash
160
+
npm install
161
+
npm start
162
+
```
163
+
> **Tip**: You can (optionally) speed up the build by commenting out the call to build_interface.py under "extra scripts" during local development. This will prevent the npm process from building the production release every time the firmware is compiled significantly decreasing the build time.
164
+
153
165
## Selecting features
154
166
155
167
Many of the framework's built in features may be enabled or disabled as required at compile time. This can help save sketch space and memory if your project does not require the full suite of features. The access point and WiFi management features are "core features" and are always enabled. Feature selection may be controlled with the build flags defined in [features.ini](features.ini).
0 30AA commit comments