Set up a Base URL (with Glitch)
Learn how to set up a Base URL with Glitch, a web-based code editor.
In the Developer Portal, some extensions have a Base URL field. This indicates that the extension must provide the URL of a server that can receive and respond to HTTP requests from Canva. You can use any programming language, framework, or architecture to handle these requests.
This tutorial explains how to set up a Base URL with:
  • Express.js - A minimal web framework for Node.js.
  • Glitch - A free, web-based editor for developing (and automatically deploying) Node.js apps.
Don't use Glitch's free service for production apps. The servers are slow and go to sleep after a few minutes of inactivity, which causes timeout errors when opening an app.

Step 1: Create a Glitch project

  1. 1.
    Navigate to glitch.com.
  2. 2.
    Click New Project.
  3. 3.
    Select glitch-hello-node.
This opens Glitch's code editor.

Step 2: Install Express.js

  1. 1.
    Open the package.json file.
  2. 2.
    Click Add package.
  3. 3.
    Search for "express".
  4. 4.
    Select the first result.
This installs Express.js.

Step 3: Set up the server

Replace the contents of the server.js file with the following code:
1
const express = require("express");
2
const app = express();
3
4
app.use(express.json());
5
app.use(express.static("public"));
6
7
// Routes go here
8
9
app.listen(process.env.PORT || 3000);
Copied!
This code initializes an Express.js server without any endpoints. The required endpoints depend the extensions added to the endpoint and how the extensions are configured.
Glitch automatically loads environment variables from the project's .env file.

Step 3: Get the public URL of the server

For Canva to send requests to a Base URL, it needs to be exposed via a publicly available URL. This is something that Glitch provides without any further setup.
To get the public URL of a Glitch server:
  1. 1.
    Click Share.
  2. 2.
    Copy the URL from the Live site field.
This URL is the value that should be entered into an extension's Base URL field.

(Optional) Step 4: Open the logs

To verify that the server is running as expected—and to debug any errors that may occur—it's useful to view the logs.
To view the logs of a Glitch server:
  1. 1.
    Click Tools.
  2. 2.
    Click Logs

More information

To learn more about Glitch, see the Glitch Help Center.
Last modified 14d ago