ZLUX App filesystem structure - 1000TurquoisePogs/zlux GitHub Wiki
A Zowe App can be loaded from a filesystem accessible to the Zowe App Server, or dynamically at runtime. When accessed from a filesystem, there are important considerations for both the developer and the end-user as to where files must be placed for proper build, packaging, and operation.
Root files & directories
At the root of an App's directory, the following content is found
pluginDefinition.json
This file describes a Plugin to the App server. A Plugin
is the unit of extensibility for the App server, where an App is a Plugin
of type Application
, the most common and visible to the end-user.
A definition file will tell the server whether the App has server-side Dataservices, client-side web content, or both.
The attributes of this file and how it is found by the server are described in the Plugin Definition article.
Dev & Source content
Aside from demonstration or open source Apps, the following directories should not be seen on a deployed server, since the directories are not read by the server but are used to build content that is.
nodeServer
When an App has Dataservices of the type "router", these are interpreted by the App Server by attaching them as ExpressJS routers. It is strongly suggested that Apps be written in Typescript, as it leads to more well-structured code than Javascript. Use of Typescript results in build steps as the pre-transpilation Typescript content is not to be consumed by NodeJS. Therefore, within nodeServer, you should keep your server-side source code. At runtime, the server loads router dataservices from the lib directory.
webClient
When an App has the webContent attribute in its Definition, the server will serve static content for a client. It is strongly suggested that Apps be written in Typescript (above) and packaged via Webpack in order to optimize loading of the App to the user. Use of Typescript and Webpack both result in build steps as the pre-transpilation Typescript and the pre-webpack content are not to be consumed by the browser. Therefore, the source code should be separated from the served content by placing source code within webClient.
Runtime content
At runtime, a different set of directories are used by the server & client rather than those described for use in the dev environment.
lib
The lib directory is where router-type Dataservices are loaded by use in the App Server. If the JS files that are loaded from the lib directory require NodeJS modules which are not provided by the server base (modules zlux-server-framework requires are added to NODE_PATH at runtime), then these modules must either be included in lib/node_modules for local directory lookup or be found on the NODE_PATH environment variable. nodeServer/node_modules is not automatically accessed at runtime as it is a dev & build directory.
web
The web directory is where the server will serve static content for an App that has included the webContent attribute in its Definition. Typically this directory contains the output of a webpack build. Anything put in this folder can be accessed by a client, so only put content here that is intended to be consumed by clients.
Documentation
In order for Zowe servers to pick up documentation to present to UIs, they must be in a uniform place.
The /doc folder of any Plugin can contain at its root any READMEs or documents that an administrator or developer may care about when working with a Plugin for the first time.
The /doc/swagger folder on the other hand, will be used to store .yaml extension Swagger 2.0 files that document the APIs of a Plugin's dataservices if they exist.
Other folders may exist, such as /doc/ui to document help behavior that may be shown in a UI, but is not implemented at this time.