8.1 Best Practices

Setting Permissions

The ability of an application to access data on your FME Server is dependent on the permissions granted to the token. When the application uses functions through the JavaScript API, like Data Download or Data Upload, it first has to initialize the application with a token. It is a best practice to create a new token for each application and the token should only have access to the necessary components for the application to run.

If your application is using a Web Service URL, by default it will only have access to run the workspace. If the workspace has a published parameter that requires a resource, you can also give your workspace access to a resource folder.

Instructions on creating a Web Service URL can be found in Exercise 10.

Using the Namespace Variable For the Data Upload Function

The Data Upload function is displayed in Exercise 18. When a user uses the web application, the permissions go through the account that is authorized at the beginning of the application. Each user will be anonymous. If two users upload the same file, the files will end up in the same location and be overwritten. To prevent this, each upload is given a namespace which is a randomly generated key. When using the Data Upload function, it is best to use the getSession function first. This will be demonstrated later on in the course.

Use Web Service URLs when needed

Web Service URLs are great, particularly for Data Streaming. Web Service URLs can be used to stream data directly back to the web application. This enables a user to view up to date information that has just been processed by FME Server.

Consistent Naming Conventions

Web applications may contain many resources and workspaces. Keeping workspaces organized on FME Server is important. Each workspace or other items should be named so that a user can quickly tell what workflow it belongs to.

Additionally, when working with a large number of workspaces, it is important to publish workspaces with descriptions. These descriptions will help you figure out the purpose of the workspace quickly and easily. You can also view the workspace in the Workspace Viewer for a quick overview.

Create a Project

Projects are a way to bundle multiple resources on FME Server together in one area. This is a great way to keep resources together if you ever migrate servers. If you have a web application that requires, a specific repository and a resource folder, you can combine these in a project. This project can be shared and moved to a different FME Server. We are using a project in this course to demonstrate how easy it is to use a project to migrate workspaces and resources to another FME Server.

Further Code Resources

If you are interested in increasing your knowledge of CSS, JavaScript, and HTML there are many online resources. W3Schools and Mozilla Development Networks have some excellent guides.

results matching ""

    No results matching ""