what files do I need to work on to add a route for the new page I created on the Redash app ?

The Redash app uses Universal Router for routing, I’m not familiar with this package so what I want to do is add a new route for my new page to access it.

I need to know when should I add my new route (what files) and how. I need help can someone direct me to some useful documentation? Thank you in advance :slight_smile:.

It’s pretty straightforward. You define new pages in the ./client/app/pages directory. Import them into ./client/app/pages/index.js. Define the route with routes.register.

Here’s a simple example:

// ./client/app/pages/demo/Demo.jsx
import React from "react";
import routeWithUserSession from "@/components/ApplicationArea/routeWithUserSession";
import routes from "@/services/routes";

export default function HelloWorld() {
  return (
    <div className="hello-world">Hello World!</div>
  );
}

routes.register(
  "HelloWorld",
  routeWithUserSession({
    path: "/HelloWorld",
    title: "Hello World!",
    render: pageProps => <HelloWorld {...pageProps} />,
  })
);
// ./client/app/pages/index.js

...
import "./demo/Demo";
...

Which produces this page:

1 Like

thank you, i’m really appreciate that :slight_smile:

1 Like