aWOT 3.x archive. This page describes the previous API. Read the aWOT 4 reference or the migration guide for current projects.

This historical tooling workflow targets aWOT 3.x. For aWOT 4, use the current instructions.

Serving static files in aWOT

To serve static files such as images, CSS files, and JavaScript files, use the awot-static script found in awot-scipts.

Use the following command to install awot-scripts:

$ npm install awot-scripts --save-dev 

Example configuration used in the front-end project:

{
  "scripts": {
    "awot-static": "awot-static"
  },
  "awot-static": {
   "sources": "./build",
    "indexFile": "index.html",
    "sketchDir": "./ArduinoProject",
    "exclude": [
      "*.map"
    ]
  }
}

Execute the script by running npm run awot-static.

This will generate a static gzipped payload file StaticFiles.h to the sketchDir directory. Include the file with #include "StaticFiles.h" and to mount the http handlers call app.use(staticFiles());.

See the tutorial for more details.