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 which is serving up the page.

  1. From the side-bar menu, select the 'Settings' panel (Professional Edition)
    OR select the 'Sites' panel (Enterprise MFT).
  2. Enable JSS for the site by checking the 'JSS enabled' checkbox in the Site Settings HTTP/HTTPS category.
  3. Enable JSS for the user who is the owner of the folder, into which the JSS file will be placed, as follows:
    1. Select the 'Users' panel from the side-bar menu.
    2. Select the user whose home folder will contain the jss file, e.g. 'JoeSmith'. Note that the owner of the /Public folder is the user called 'anonymous', which is hidden by default. To show it, check the 'Show system users/folder/sites' item in the View menu at the bottom left.
    3. In the 'User Properties' window, check the 'JSS(Server-side Javascript)' checkbox.
  4. 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

In this example, we create a web-app that simply displays 'Hello world' and is available publicly.

  1. Create a text file called helloworld.jss with the following content.
    response.write("Hello world");
    
  2. Save it in C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Public.
  3. Since 'anonymous' is the owner of /Public, JSS must be enabled for that user, as described above.
  4. Now navigate to http://localhost/helloworld.jss. A web-page simply 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. This web-app will be available only to the user.

  1. 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("
    ");
  2. Save it in JoeSmith's home directory, i.e. C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Users\JoeSmith.
  3. Enable JSS for the JoeSmith user, as described above.
  4. Then go to the URL http://localhost/Home/joesmith/listFiles.jss, where you should see a listing of all the files in that directory.

For more information on developing the JSS web-app, please refer to JSS Web-App Basics and the JSS API Guide.