Web Content

Adding static web content

To add static web content to a project, add a directory called web as a peer of the directory called packages. This directory should contain files whose suffixes imply well-known mime types for web content, such as .html, .css, or .js.

Note: JavaScript files in static web content are not actions but are scripts intended to run in the browser.

The web directory can have subdirectories and can be built by website builders or other tools.

Like an action directory, the web directory may contain .include or .ignore to control what is actually considered web content, as opposed to build support or intermediate results. For more information about .include and .ignore, see Multifile actions created with autozip.

The web directory also supports integrated building, just like an action directory.

Here’s an example of a project with modest web content, populated by hand. For simplicity, the actions of the project are not shown.

example3/web/chatroom.html
example3/web/chatroom.css
example3/web/runner.js
example3/web/favicon.ico

Here’s a diagram of the example3 project structure.

Figure 5: A project with static web content

Here’s the output when the project is deployed.

> nim project deploy example3
Deploying project '/path/to/example3'
to namespace '...'
on host 'https://...nimbella.io'
Deployed 4 web content items to
https://<namespace>-host.nimbella.io
Deployed actions:
...

As the output shows, the contents of the web directory were deployed to the web, with URLs within your namespace’s unique DNS domain <namespace>-host.nimbella.io, where <namespace> is your namespace. The remaining portion of the domain name may differ depending your account configuration and your API host within the Nimbella Cloud. To access the content, either http or https may be used. For https, the SSL certificate will be that of Nimbella Corp.

Notes: