Use app based route

This commit is contained in:
Andrew Pennington 2024-08-15 23:48:31 +01:00
parent 9afdecb76c
commit 049afb6eba
No known key found for this signature in database
GPG key ID: E9DA097213FD17EA
2 changed files with 13 additions and 10 deletions

13
ui/app/api/env/route.ts vendored Normal file
View file

@ -0,0 +1,13 @@
import { NextRequest, NextResponse } from 'next/server';
import process from 'process';
export async function GET(request: NextRequest) {
// Access environment variables
const envVars = {
BACKEND_API_URL: process.env.BACKEND_API_URL,
BACKEND_WS_URL: process.env.BACKEND_WS_URL
}
// Return the environment variables as a JSON response
return NextResponse.json(envVars);
}

View file

@ -1,10 +0,0 @@
import process from 'process';
export default function handler(req, res) {
const envVars = {
BACKEND_API_URL: process.env.BACKEND_API_URL,
BACKEND_WS_URL: process.env.BACKEND_WS_URL
}
res.status(200).json(envVars);
}