Skip to main content

App

General application parameters.


buildServiceFullURL​


_app.buildServiceFullURL(path: string) : string​

Attributes​
NAMETYPEDESCRIPTION
pathstring
Return​

( string )


buildServiceURL​


_app.buildServiceURL(path: string) : string​

Attributes​
NAMETYPEDESCRIPTION
pathstring
Return​

( string )


config​


_app.config() : Values​

Description​

Obtains the application configuration data present in the file in the config folder.

How To Use​
// Returns the name of the app configured in config/_[environment].json

const appName = _app.config().getString("name");
_out.println(`App Name: ${appName}`);
Return​

( Values )

Returns a structure with the configuration parameters.


configReloaded​


_app.configReloaded() : boolean​

Description​

Checks whether the application configuration has been changed.

How To Use​
// Validates whether the configuration has been changed.

if (_app.configReloaded()) {
_out.println(`App config is up to date.`);
}
Return​

( boolean )

Returns whether the configuration was changed and reloaded.


file​


_app.file(path: string) : File​

Description​

Processes files within the application.

How To Use​
// Load the full path of the Logo:
const logo = _app.file("public/images/logo.png");
_out.println(`<p>Full logo path: ${logo.fullPath()}</p>`);
// Creates the JSON file within the app at public/data.json:
_app.file("public/data.json").output().writeAndClose(
_val.map()
.set("result", true)
.toJSON(2)
)
// Load the JSON file into the app at public/data.json:
const jsonFile = _app.file("public/data.json")
if (jsonFile.exists()) {
const data = _val.fromJSON(
jsonFile.input().readAllAndClose()
)
_out.println(`<p>JSON Result: ${data.getString("result")}</p>`)
}
Attributes​
NAMETYPEDESCRIPTION
pathstringRelative file path within the application.
Return​

( File )

Returns the file object obtained through the path.


folder​


_app.folder(path: string) : File​

Description​

Tracks all the files present in the folder of the inserted path.

Attributes​
NAMETYPEDESCRIPTION
pathstringPath of the file.
Return​

( File )

Returns all files present in the folder of the inserted path.


getConfig​


_app.getConfig() : Values​

Description​

Obtains the application configuration data present in the file in the config folder.

How To Use​
// Returns the name of the app configured in config/_[environment].json

const appName = _app.config().getString("name");
_out.println(`App Name: ${appName}`);
Return​

( Values )

Returns a structure with the configuration parameters.


getFile​


_app.getFile(path: string) : File​

Description​

Processes files within the application.

How To Use​
// Load the full path of the Logo:
const logo = _app.file("public/images/logo.png");
_out.println(`<p>Full logo path: ${logo.fullPath()}</p>`);
// Creates the JSON file within the app at public/data.json:
_app.file("public/data.json").output().writeAndClose(
_val.map()
.set("result", true)
.toJSON(2)
)
// Load the JSON file into the app at public/data.json:
const jsonFile = _app.file("public/data.json")
if (jsonFile.exists()) {
const data = _val.fromJSON(
jsonFile.input().readAllAndClose()
)
_out.println(`<p>JSON Result: ${data.getString("result")}</p>`)
}
Attributes​
NAMETYPEDESCRIPTION
pathstringRelative file path within the application.
Return​

( File )

Returns the file object obtained through the path.


getFolder​


_app.getFolder(path: string) : File​

Description​

Tracks all the files present in the folder of the inserted path.

Attributes​
NAMETYPEDESCRIPTION
pathstringPath of the file.
Return​

( File )

Returns all files present in the folder of the inserted path.


getName​


_app.getName() : string​

Description​

Gets the name of the application.

How To Use​
const appName = _app.name();
Return​

( string )

Returns the name of the application.


getPath​


_app.getPath(path: string) : File​

Description​

Provides the file manipulation object for the path within the application.

How To Use​
// Create the temp folder in the app's root directory.
_app.path("temp").mkdir()
Attributes​
NAMETYPEDESCRIPTION
pathstringRelative path of the file or folder within the application.
Return​

( File )

Returns the manipulation object to the path.


getPathBase​


_app.getPathBase() : string​

Description​

Gets the application root path.

How To Use​
const appRootPath = _app.pathBase();
Return​

( string )

Returns the base location of the application.


getPathConfig​


_app.getPathConfig() : string​

Description​

Gets the path to the application config folder.

How To Use​
const configPath = _app.pathConfig();
Return​

( string )

Returns the location of the configuration folder.


getPathHome​


_app.getPathHome() : string​

Description​

Gets the application root path.

How To Use​
const appRootPath = _app.pathHome();
Return​

( string )

Returns the base location of the application.


getPathPublic​


_app.getPathPublic() : string​

Description​

Gets the public folder location.

How To Use​
const publicPath = _app.pathPublic();
Return​

( string )

Returns the public folder location.


getPathServer​


_app.getPathServer() : string​

Description​

Gets the server folder location.

How To Use​
const serverPath = _app.pathServer();
Return​

( string )

Returns the server folder location.


getPathStorage​


_app.getPathStorage() : string​

Description​

Gets the storage folder location.

How To Use​
const storagePath = _app.pathStorage();
Return​

( string )

Returns the storage folder location.


getSettings​


_app.getSettings() : Values​

Description​

Obtains the application settings data present in the file of the config.

How To Use​
// Returns the custom settings that are in config/_[environment].json
// in ... "settings": { "maxTickets": 8 }

const maxTickets = _app.settings().getString("maxTickets");
_out.println(`The maximum limit for tickets is: ${maxTickets}`);
Return​

( Values )

Returns the custom settings.


getUrl​


_app.getUrl() : string​

Description​

Gets the application url.

How To Use​
const urlDaApp = _app.url();
Return​

( string )

Returns the URL of the application.


_app.getUrl(key: string) : string​

Description​

Gets the URL prefix defined in the configuration, as a custom URL prefix.

How To Use​
const urlCustom = _app.url('name-of-my-configured-url');
Attributes​
NAMETYPEDESCRIPTION
keystringName of the configured url.
Return​

( string )

Returns the location prefix defined in the configuration.


getUrlAdmin​


_app.getUrlAdmin() : string​

Description​

Gets the application url for the administration interface.

How To Use​
const adminURL = _app.urlAdmin();
Return​

( string )

Returns the location prefix of the administration.


getUrlFileSystem​


_app.getUrlFileSystem() : string​

Description​

Gets the application url for the filesystem folder.

How To Use​
const fsURL = _app.urlFileSystem();
Return​

( string )

Returns the location of the filesystem folder.


getUrlFileSystemPrivate​


_app.getUrlFileSystemPrivate() : string​

Description​

Gets the application url for the private folder.

How To Use​
const fsPrivateURL = _app.urlFileSystemPrivate();
Return​

( string )

Returns the location of the filesystem's private folder.


getUrlFileSystemPublic​


_app.getUrlFileSystemPublic() : string​

Description​

Gets the application url for the filesystem's public folder.

How To Use​
const fsPublicURL = _app.urlFileSystemPublic();
Return​

( string )

Returns the location of the filesystem's public folder.


getUrlFileSystemServer​


_app.getUrlFileSystemServer() : string​

Description​

Gets the application url for the filesystem's server folder.

How To Use​
const fsServerURL = _app.urlFileSystemServer();
Return​

( string )

Returns the location of the filesystem's server folder.


getUrlPublic​


_app.getUrlPublic() : string​

Description​

Gets the application url for the public folder.

How To Use​
const appPublicURL = _app.urlPublic();
Return​

( string )

Returns the location of the public folder.


getUrlServices​


_app.getUrlServices() : string​

Description​

Gets the application url for the services folder.

How To Use​
const servicesURL = _app.urlServices();
Return​

( string )

Returns the location of the services.


getUrlStorage​


_app.getUrlStorage() : string​

Description​

Gets the application url for the storage folder.

How To Use​
const appStorageURL = _app.urlStorage();
Return​

( string )

Returns the location of the storage folder.


isConfigReloaded​


_app.isConfigReloaded() : boolean​

Description​

Checks whether the application configuration has been changed.

How To Use​
// Validates whether the configuration has been changed.

if (_app.configReloaded()) {
_out.println(`App config is up to date.`);
}
Return​

( boolean )

Returns whether the configuration was changed and reloaded.


isFile​


_app.isFile(path: string) : boolean​

Description​

Verify if a file exists.

Attributes​
NAMETYPEDESCRIPTION
pathstringPath of the file.
Return​

( boolean )

Returns a boolean verification of the existence of the file and tracks it.


isFolder​


_app.isFolder(path: string) : boolean​

Description​

Verify if exists a folder in the inserted path.

Attributes​
NAMETYPEDESCRIPTION
pathstringPath of the folder.
Return​

( boolean )

Returns a boolean verification of the existence of the file and tracks it folder location.


name​


_app.name() : string​

Description​

Gets the name of the application.

How To Use​
const appName = _app.name();
Return​

( string )

Returns the name of the application.


path​


_app.path(path: string) : File​

Description​

Provides the file manipulation object for the path within the application.

How To Use​
// Create the temp folder in the app's root directory.
_app.path("temp").mkdir()
Attributes​
NAMETYPEDESCRIPTION
pathstringRelative path of the file or folder within the application.
Return​

( File )

Returns the manipulation object to the path.


pathBase​


_app.pathBase() : string​

Description​

Gets the application root path.

How To Use​
const appRootPath = _app.pathBase();
Return​

( string )

Returns the base location of the application.


pathConfig​


_app.pathConfig() : string​

Description​

Gets the path to the application config folder.

How To Use​
const configPath = _app.pathConfig();
Return​

( string )

Returns the location of the configuration folder.


pathHome​


_app.pathHome() : string​

Description​

Gets the application root path.

How To Use​
const appRootPath = _app.pathHome();
Return​

( string )

Returns the base location of the application.


pathPublic​


_app.pathPublic() : string​

Description​

Gets the public folder location.

How To Use​
const publicPath = _app.pathPublic();
Return​

( string )

Returns the public folder location.


pathServer​


_app.pathServer() : string​

Description​

Gets the server folder location.

How To Use​
const serverPath = _app.pathServer();
Return​

( string )

Returns the server folder location.


pathStorage​


_app.pathStorage() : string​

Description​

Gets the storage folder location.

How To Use​
const storagePath = _app.pathStorage();
Return​

( string )

Returns the storage folder location.


settings​


_app.settings() : Values​

Description​

Obtains the application settings data present in the file of the config.

How To Use​
// Returns the custom settings that are in config/_[environment].json
// in ... "settings": { "maxTickets": 8 }

const maxTickets = _app.settings().getString("maxTickets");
_out.println(`The maximum limit for tickets is: ${maxTickets}`);
Return​

( Values )

Returns the custom settings.


url​


_app.url() : string​

Description​

Gets the application url.

How To Use​
const urlDaApp = _app.url();
Return​

( string )

Returns the URL of the application.


_app.url(key: string) : string​

Description​

Gets the URL prefix defined in the configuration, as a custom URL prefix.

How To Use​
const urlCustom = _app.url('name-of-my-configured-url');
Attributes​
NAMETYPEDESCRIPTION
keystringName of the configured url.
Return​

( string )

Returns the location prefix defined in the configuration.


urlAdmin​


_app.urlAdmin() : string​

Description​

Gets the application url for the administration interface.

How To Use​
const adminURL = _app.urlAdmin();
Return​

( string )

Returns the location prefix of the administration.


urlFileSystem​


_app.urlFileSystem() : string​

Description​

Gets the application url for the filesystem folder.

How To Use​
const fsURL = _app.urlFileSystem();
Return​

( string )

Returns the location of the filesystem folder.


urlFileSystemPrivate​


_app.urlFileSystemPrivate() : string​

Description​

Gets the application url for the private folder.

How To Use​
const fsPrivateURL = _app.urlFileSystemPrivate();
Return​

( string )

Returns the location of the filesystem's private folder.


urlFileSystemPublic​


_app.urlFileSystemPublic() : string​

Description​

Gets the application url for the filesystem's public folder.

How To Use​
const fsPublicURL = _app.urlFileSystemPublic();
Return​

( string )

Returns the location of the filesystem's public folder.


urlFileSystemServer​


_app.urlFileSystemServer() : string​

Description​

Gets the application url for the filesystem's server folder.

How To Use​
const fsServerURL = _app.urlFileSystemServer();
Return​

( string )

Returns the location of the filesystem's server folder.


urlPublic​


_app.urlPublic() : string​

Description​

Gets the application url for the public folder.

How To Use​
const appPublicURL = _app.urlPublic();
Return​

( string )

Returns the location of the public folder.


urlServices​


_app.urlServices() : string​

Description​

Gets the application url for the services folder.

How To Use​
const servicesURL = _app.urlServices();
Return​

( string )

Returns the location of the services.


urlStorage​


_app.urlStorage() : string​

Description​

Gets the application url for the storage folder.

How To Use​
const appStorageURL = _app.urlStorage();
Return​

( string )

Returns the location of the storage folder.