> For the complete documentation index, see [llms.txt](https://discord-base.gitbook.io/discord-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://discord-base.gitbook.io/discord-base/templates/route.md).

# Route

You can create new routes in app/routes

{% hint style="warning" %}
The **ROUTE PATH** is determined by the file structure within the **routes** directory of your application. For instance, if you have a file located at `app/routes/test.ts`, this will correspond to the URL path `DOMAIN/test` when accessed through a web browser. This mapping helps in organizing and accessing different parts of your application based on the URL structure.
{% endhint %}

## `Endpoints`

{% hint style="info" %}
You don't need a decorator, you can simply specify the exports as methods such as
{% endhint %}

```typescript
export async function GET(client: Client, req: Request, res: Response) {
	return res.json({
		message: `Got a GET request`,
	});
}
```

## `Interacting with discord`

You can access the client through the `client` parameter.

```typescript
export async function GET(client: Client, req: Request, res: Response) {
	const guild = await client.guilds.fetch(String("1103319264921915392"));
	const channel = await guild.channels.fetch(String("1260799306315731085"));

	if (channel && channel.isTextBased()) {
		await channel.send("Got a GET request");
		console.log(`Message sent to channel ${channel.name}`);
	}
	
	return res.json({
		message: `Message sent to channel: ${channel ? channel.name : "unknown"}`,
	});
}
```
