The way it generally works in OAE is you request something like
/docs/index.html which has a script tag that pulls in requirejs with a
list of scripts to load. For that file it looks like:
The thing to notice there is that the template was in the html, it's just
commented out inside a div, and the rendered output gets written to a
different div on the page.
So the markup and client side js are just served from static files in the
3akai-ux package. For the Hilary apis we register the paths under the
/api directory. For the /api/doc/module that we used in this example it's
in Hilary node_modules/oae-doc/lib/rest.js and looks like this:
var OAE = require('oae-util/lib/oae');
...
OAE.tenantServer.get('/api/doc/module/:moduleId', function(req, res) {
That tells the server that it should answer http GET requests that start
with "/api/doc/module" with this function and to treat the next path
element as a variable called "moduleId". Inside that function we call to
the oae-doc/lib/api.js to perform the logic, which if it used the
database would make calls to something like oae-doc/lib/dao.js which
would contain the CQL calls for cassandra.
The way it generally works in OAE is you request something like /docs/index.html which has a script tag that pulls in requirejs with a list of scripts to load. For that file it looks like:
The /docs/js/doc.js then makes ajax requests to the Hilary apis to get back json data. In this case, that looks like:
It then renders that json into the page like this:
The thing to notice there is that the template was in the html, it's just commented out inside a div, and the rendered output gets written to a different div on the page.
So the markup and client side js are just served from static files in the 3akai-ux package. For the Hilary apis we register the paths under the /api directory. For the /api/doc/module that we used in this example it's in Hilary node_modules/oae-doc/lib/rest.js and looks like this:
That tells the server that it should answer http GET requests that start with "/api/doc/module" with this function and to treat the next path element as a variable called "moduleId". Inside that function we call to the oae-doc/lib/api.js to perform the logic, which if it used the database would make calls to something like oae-doc/lib/dao.js which would contain the CQL calls for cassandra.