Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions apps/mastra-gateway/src/app/access-requested/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ export default function AccessRequestedPage({
<p className="eyebrow">Mastra Gateway</p>
<h1>Access Requested</h1>
<AccessReason searchParams={searchParams} />
<a className="button-link" href="/api/auth/login">
Try again
</a>
<form action="/api/auth/login">
<button className="button-link" type="submit">
Try again
</button>
</form>
</section>
</main>
)
Expand Down
4 changes: 3 additions & 1 deletion apps/mastra-gateway/src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default async function AdminPage() {
</div>
<nav className="top-actions" aria-label="Gateway navigation">
<Link href="/studio">Studio</Link>
<a href="/api/auth/logout">Sign out</a>
<form action="/api/auth/logout">
<button type="submit">Sign out</button>
</form>
</nav>
</header>

Expand Down
30 changes: 30 additions & 0 deletions apps/mastra-gateway/src/app/api/[[...path]]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { proxyMastraRequest } from "@/lib/mastra-proxy"

type RouteContext = {
params: Promise<{ path?: string[] }>
}

export async function GET(request: Request, context: RouteContext) {
return proxyMastraApiPath(request, context)
}

export async function POST(request: Request, context: RouteContext) {
return proxyMastraApiPath(request, context)
}

export async function PUT(request: Request, context: RouteContext) {
return proxyMastraApiPath(request, context)
}

export async function PATCH(request: Request, context: RouteContext) {
return proxyMastraApiPath(request, context)
}

export async function DELETE(request: Request, context: RouteContext) {
return proxyMastraApiPath(request, context)
}

async function proxyMastraApiPath(request: Request, context: RouteContext) {
const { path = [] } = await context.params
return proxyMastraRequest(request, `/api/${path.join("/")}`)
}
1 change: 1 addition & 0 deletions apps/mastra/src/mastra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const serviceKeys = parseServiceApiKeys(env.MASTRA_SERVICE_API_KEYS)
export const mastra = new Mastra({
agents: { smokeAgent },
server: {
studioBase: "/studio",
apiRoutes: [
registerApiRoute("/forge-smoke", {
method: "POST",
Expand Down
Loading