Class

CustomPath

CustomPath

CustomPath is used for managing redirects and static pages via the editor. It corresponds to the /api/v1/custom-urls/:path.

Example

import { CustomPath } from "@quintype/framework/server/api-client";

async function loadCustomPath(client, path) {
  const page = await CustomPath.getCustomPathData(client, path);
  if(!page) {
    return404();
  } else if (page.type == 'redirect') {
    redirectTo(page["destination-path"]);
  } else if (page.type == 'static-page') {
    renderPage(page);
  }
}

Methods

static getCustomPathData(client, path)

This function is used to get the page from the API. See CustomPath's example for a usage example

Parameters:
Name Type Description
client Client

Client

path string

The path which may be a redirect or static page

See:

View Source index.js, line 456

asJson()

Use this to convert to a simple javascript object, suitable for JSON.

View Source index.js, line 446