<!DOCTYPE html>
<html>

<head>
  <title>NodeActa WEB</title>
  <style>
	body {
      font-family: Tahoma, sans-serif;
	  font-size: 13px;
    }
	code {
      font-style: italic;
    }
  </style>
</head>

<body>
  <div class="main">
	<h1>NodeActa WEB</h1>
	<p>
	This is your NodeActa WEB index page.<br/>
	When you land on your NodeActa Server address using a web browser, this page will be displayed.<br/>
	In NodeActa Application Center this matches your `Web` app, so if you need to customize it, that would be the place to start.<br/>
	You can override this with NodeActa Server configuration file. If you specify `WebRoot` option, NodeActa Server will serve index.html file found at specified location. <br />
	But even than, you can access this page via 'http://yourserver/web/', or any other web app via 'http://yourserver/web/demo/'
	</p>
	<p>
	Web browsers, by default, accesses NodeActa Server using `anonymous` user.<br/>
	You can grant `execution` right to `anonymous` user for desired apps, but in the case you need user authentication, just do a POST request to `https://yourserver/` with Basic authentication, like this:<br />
	<pre><code>
	fetch('/', {
		method: 'POST',
		headers: { 'Authorization': 'Basic ' + btoa(user + ":" + password) }
	}); 
	</code></pre> 
	The best practice is to convert this html to login page and on your login button click call fetch() like in the sample above.<br />
	<br />	
	This index.html is an example of a static html content. In the case you need to generate a dynamic html page on NodeActa Server and then feed it to a web browser, you can create a standard NodeActa app with `index.mjs` file, and in `run()` method return your generated html.<br />
	Here is an <a href="/web/TestWeb/">example</a>:
	</p>
	<pre><code>
	export class TestWeb extends App {
		async run() {
			return `&lt;!DOCTYPE html&gt;
				&lt;html&gt;
				&lt;h2&gt;Hello, NodeActa World!&lt;/h2&gt;
				&lt;div&gt;Time: ${(new Date()).toLocaleTimeString()}&lt;/div&gt;
				${(function () { return 'do some java script to produce html'; })()}
				&lt;p&gt;This HTML was generated by NodeActa Servver.&lt;/p&gt;
				&lt;/html&gt;`;
		}
	}
	</code></pre>
  </div>
</body>
</html>