CloudGlue is in closed beta. Please email cloudglue@xemware.com to request an invite.
Help is being rapidly developed, please bear with us.

End Points

End points are the mechanism for executing your business logic and serving content to clients in response to a specified url path.

For example for url https://myapp.cloudgluesite.com/end/point/path the end point path is /end/point/path.

A typical site you will have a number of end points that perform one or related actions e.g. a signup end point that serves a Signup form on GET request, and attempts the signin on form submit (POST).

End Point Execution

End points execute in a pipeline.

  1. Incoming HTTP request
  2. Map hostname to a site
  3. Determine site version
  4. Map request path to an end point
  5. Execute end point script if enabled
  6. Render page template if specified
  7. Send output

Map hostname to a site

Your site is mapped to the url https://sitesubdomain.cloudgluesite.com (support for custom domains coming Jan 2014).

The hostname is sitesubdomain.cloudgluesite.com. If a site with specified subdomain 'sitesubdomain' is located the pipeline continues otherwise the request is redirected to a generic error page.

Determine site verison

By default the active site version will be used. You can override this by referencing a specific version in the url path e.g.

https://mysite.cloudgluesite.com/_v/<versionid>

Map request path to an end point

The pipeline executor tries to find an end point that matches the request path. Read about end point paths to understand what patterns are supported for paths.

If no matching end point is located, then find an end point with path /invalidpage, then /error. If no matches at this point a 401 error is returned.

Execute end point script

If the script is enabled (for performance reasons disable it if not being used), a bunch of context data is passed to the onRequest function in the script.

When a script completes it indicates outcome by calling a function on the passed request parameter.

Read about end point scripts for details.

Render page template

If a page template is specified it will be rendered if an enabled script hasn't indicated an error or redirect should occur.

Read about end point page rendering for details on what context data and helpers are available to page templates.

Scripts can also specify a return body via the response.body property

Send output

At this stage one of following outcomes occurred:

  • response.next() was called and response.body contains content either explicitly set or generated from a page template
  • response.redirect(url) was called which returns a 301 redirect to the caller
  • response.error() was called which returns a JSON error object
  • response.end() was called which returns terminates pipeline processing (this is only relevant when support for multiple scripts is enabled), and response.body is returned