Get Route

Retrieves detailed information about a specific route by its unique ID in Cortado.js. This includes HTTP method, path, middleware, and handler details.

GET

GET

https://api.cortado.com/v1/routing/{route_id}

Request

No body required. Route ID is passed as a path parameter. Authentication is required to ensure the user’s permission.

Parameters

Parameters

Type

Description

route_id

string

Unique identifier of the route

Based on the steps above, your code might look something like this. It brings together the key concepts covered — from setup and configuration to routing, authentication, or event handling. Feel free to adapt it to suit your specific use case.

main.ts

import axios from 'axios';

async function getRoute(routeId: string) {
  const res = await axios.get(`https://api.cortado.com/v1/routing/${routeId}`, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    },
  });

  return res.data;
}

main.ts

import axios from 'axios';

async function getRoute(routeId: string) {
  const res = await axios.get(`https://api.cortado.com/v1/routing/${routeId}`, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    },
  });

  return res.data;
}

main.ts

import axios from 'axios';

async function getRoute(routeId: string) {
  const res = await axios.get(`https://api.cortado.com/v1/routing/${routeId}`, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    },
  });

  return res.data;
}

Response

Returns route metadata including HTTP method, path, middleware list, and handler info. Returns error if route not found or unauthorized.

main.ts

{
  "id": "route_123abc",
  "method": "GET",
  "path": "/users/:id",
  "middleware": ["auth", "logging"],
  "handler": "getUserById",
  "createdAt": "2025-07-14T12:00:00Z"
}

main.ts

{
  "id": "route_123abc",
  "method": "GET",
  "path": "/users/:id",
  "middleware": ["auth", "logging"],
  "handler": "getUserById",
  "createdAt": "2025-07-14T12:00:00Z"
}

main.ts

{
  "id": "route_123abc",
  "method": "GET",
  "path": "/users/:id",
  "middleware": ["auth", "logging"],
  "handler": "getUserById",
  "createdAt": "2025-07-14T12:00:00Z"
}

Was this helpful?

Dismiss

Was this helpful?

Dismiss

Last updated on

Aug 8, 2025