Mojito also lets you statically serve files such as controllers, binders, assets (CSS and JavaScript), etc. You can access static resources through a URL that contains the following three components:
The URL of the static URL has the following syntax: /static/{source_path}/{relative_path}
The prefix default is /static/, but can be changed through the staticHandling object in the configuration object of application.json.
The source path is based on resource level within Mojito. The three resource levels are framework, application, and mojit.
The source paths for the three levels are the following:
The relative path is the path to the resource relative to the source path. For example, the binder index.js for the Foo mojit would have the relative path /binders/index.js.
Static URL to the framework-level resource helper.js:
/static/mojito/helper.js
Static URL to the application-level resource photos/binders/photo_search.js:
/static/photos/binders/photo_search.js
The application is photos.
Static URL to the mojit-level resource scroll/assets/body.css:
/static/scroll/assets/body.css
The mojit is scroll.
Static URL to the application-level resource finance/assets/ticker.css:
/app_resources/finance/assets/ticker.css
In this example, the default prefix was overridden in the staticHandling object to be app_resources.