To avoid content flash on initial application loading, you can embed an SQL query in your application html. When RdbHost.com sends the app html page to the browser, it scans for an embedded query, executes the query, and inlines the results, as JSON, into the html.
The embedded SQL is part of a script tag, as attribute 'sql' or 'data-sql'. The query is executed as the role given by the 'role' or 'data-role' attribute, by default the preauth role.. The script must have id 'RDBHOST-SQL-INLINE-ID', and be of a type that the browser will ignore. I suggest type 'text/sql'.
<script id="RDBHOST-SQL-INLINE-ID" type="text/sql" data-sql="SELECT * FROM samples" data-role=p0000000014></script> <script> var json = $('#RDBHOST-SQL-INLINE-ID').html(), data = JSON.parse(json), // do something with data </script>
If the query errors, the error will be provided as the body, in the usual RdbHost JSON error format.