Skip to main content

routes.json Overview

The routes.json file is a crucial configuration file in our application that defines the structure and behavior of routes and their associated components. This file provides metadata for each route, including path, authority, loaders, and component paths.

Purpose

The main purposes of routes.json are:

  1. Define the application's route structure
  2. Specify component paths for each route
  3. Configure authentication and authorization requirements
  4. Set up data loading mechanisms (server-side and client-side)
  5. Define GraphQL queries associated with routes
  6. Specify additional permissions and configurations

Basic Structure

Each entry in routes.json represents a route and is structured as follows:

{
"/path": {
"key": "unique.key",
"name": "Human Readable Name",
"path": "/path",
"componentPath": "path/to/component.js",
"auth": true,
"authority": ["required.permission"],
"hasLoader": true,
// ... other configurations
}
}

Key Benefits

  1. Centralized Configuration: All route-related information is in one place.
  2. Automatic Wrapping: The application can automatically apply necessary wrappers based on the configuration.
  3. Separation of Concerns: Clearly separates routing logic from component implementation.
  4. Easy Maintenance: Simplifies the process of adding, modifying, or removing routes.

Back to Index | Next: Field Descriptions