# Publishing to the web

# Files needed

# app.json

This file contains a configuration of the WebUI for the users. It allows me as a developer to set the variable names and how the guide for creating the app will look for the user when configuring the app.

{
  "author": "IoT Open",
  "licence": "MIT",
  "input": {
    "actuator_function": {
      "type": "single_function_selector",
      "name": "Controlled functions",
      "description": "This function that is turned to on when app is triggered."
    },
    "trigger_function": {
      "type": "single_function_selector",
      "name": "Trigger function",
      "description": "The door that will trigger the light to turn on."
    },
    "timeout": {
      "type": "number",
      "name": "Light on time",
      "description": "The time that the control function will be on before turning off again in minutes.",
	  "default": "10"
    }
  },
  "guide": [
    {
      "id": "stage_1",
      "title": "Function selection",
      "description": "Set the functions you want to use.",
      "input_fields": [
        "trigger_function",
        "actuator_function"
      ]
    },
	{
	  "id": "stage_2",
	  "title": "Timeout settings",
	  "description": "",
	  "input_fields": [
		"timeout"
	  ]
	}
  ]
}

The above json will generate two pages of configuration. One page for configuring the functions, and a second page for the user to set the timeout. The interface will also have more pages to set installation, name, and a summary to confirm all parameters before saving.

# app.lua

This file contains all code as shown on the previous page.

# Uploading and setting version name

# Create a new app

I use the edge-app page to create a new app. The apps have some basic data that needs to be added by the user for the indexing to work correctly.

# Upload

When an app has been created we can create a new version for it in the web-interface. This is done in the Versions tab on the edit page for the created app. Here I just select the two files created above and press upload to let the server handle the rest.

# Set a name for this version

All uploaded code gets a hash as identifier, it is possible to change this into a more user-friendly name. I always use SemVer (opens new window) for my releases and this is what I do here as well. First release is then called v1.0.0.