-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifying the example. Still more work to go.
- Loading branch information
1 parent
8c7cba8
commit e0eaead
Showing
22 changed files
with
108 additions
and
1,198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
node_modules | ||
web/.lastModified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,18 @@ | ||
HttpServer Config Network | ||
HttpServer Firmware Upload | ||
========================= | ||
|
||
Introduction | ||
------------ | ||
|
||
The HTTP server coming with Sming is quite powerful but it is limited | ||
from the available resources of the underlining hardware (your favorite | ||
ESP8266 microcontroller). Serving multiple files at once can be | ||
problematic. It is not the size of the files that can cause problems, | ||
but the number of simultaneous files that need to be delivered. | ||
Therefore if you serve multiple CSS or JS files you can optimize your | ||
web application before uploading it into your ESP8266 using the advice | ||
below. | ||
ESP8266 microcontroller). | ||
|
||
Optimizing File Delivery | ||
------------------------ | ||
This sample demonstrates how to enable file upload of the HTTP server. | ||
On a normal computer the file uploads are usually using | ||
temporary space on the hard disk or in memory to store the incoming data. | ||
|
||
In this example you will see how to combine CSS and JS files, compress | ||
them and deliver the optimized content via the HTTP server. | ||
|
||
Installation | ||
~~~~~~~~~~~~ | ||
|
||
The file optimization uses ``gulp``. To install it and the needed gulp | ||
packages you need to install first `npm <https://www.npmjs.com/>`__. Npm | ||
is the Node.JS package manager. Once you are done with the installation | ||
you can run from the command line the following: | ||
|
||
npm install | ||
|
||
The command above will install gulp and its dependencies. | ||
|
||
Usage | ||
~~~~~ | ||
|
||
During the development of your web application you should work only in | ||
the ``web/dev/`` folder. Once you are ready with the application you can | ||
``pack`` the resources and ``upload`` them to your device. The commands | ||
are | ||
|
||
make web-pack make web-upload | ||
|
||
That should be it. | ||
On an embedded device that is a luxury that we can hardly afford. | ||
In this sample we demonstrate how to define which file upload fields | ||
should be stored and what (file) streams are responsible for storing the data. | ||
If a field is not specified then its content will be discarded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
SPIFF_FILES = web/build | ||
SPIFF_FILES = web/ | ||
ARDUINO_LIBRARIES := ArduinoJson6 | ||
|
||
# The line below enables the form upload support on the server | ||
ENABLE_HTTP_SERVER_MULTIPART = 1 | ||
|
||
web-pack: | ||
$(Q) gulp | ||
$(Q) date +'%a, %d %b %Y %H:%M:%S GMT' -u > web/build/.lastModified | ||
$(Q) date +'%a, %d %b %Y %H:%M:%S GMT' -u > web/.lastModified | ||
|
||
web-upload: web-pack spiff_update | ||
$(call WriteFlash,$(SPIFF_START_OFFSET)=$(SPIFF_BIN_OUT)) |
Oops, something went wrong.