Host a web-app in CompleteFTP
This tutorial will give you two simple examples on how to host web-applications in CompleteFTP.
Before getting started, you need to enable the 'Server-side Javascript (JSS)' property on the site serving up the page.
- From the side-bar menu, select the 'Settings' panel (Professional Edition)
OR select the 'Sites' panel (Enterprise Edition).

- Enable JSS by checking the 'JSS enabled' checkbox in HTTP/HTTPS category.

- Click the 'Apply changes' button at the top right of the CompleteFTP Manager.

Now, let's create our own web-application in Javascript.
Example 1
- Create a text file called helloworld.jss with the following content.
response.write("Hello world");
- Save it in C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Public.
- Now navigate to http://localhost/helloworld.jss. A web-page just saying 'Hello world' will show up.

Example 2
In this example, we're going to create a .jss file in a user's home directory and execute it as a JSS
web application. Therefore, we must enable JSS for both the site serving the page (which we have done at
the beginning of this tutorial) and the user who owns the folder that contains the file.
Now, let's enable JSS for the user.
- Select the 'Users' panel from the side-bar menu.

- Select the user whose home folder will contain the jss file, e.g. 'JoeSmith'.

- In the 'User Properties' window, check the 'JSS(Server-side Javascript)' checkbox.

- Click the 'Apply changes' button at the top right of the CompleteFTP Manager.

Now, JSS has been enabled for both the site and the user. So let's create a web-app that simply lists the files in the user's home directory.
- Create a file called listFiles.jss with the following content:
response.write("<h1>" + system.user.homeFolder + "</h1>");
response.write("");
var homeFolder = system.getFile(system.user.homeFolder)
var files = homeFolder.getFiles();
files.forEach(function(file) {
response.write("" + file.name + "")
});
response.write("");
- Save it in the JoeSmith's home directory, i.e. C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Users\JoeSmith.
- Then go to URL http://localhost/Home/joesmith/listFiles.jss, you should see a listing of all the files in the directory.
