18 lines
618 B
TypeScript
18 lines
618 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
if (process.env.NODE_ENV === 'development')
|
|
{
|
|
const user = process.env.NUXT_PRIVATE_SUPERUSER_USER;
|
|
const password = process.env.NUXT_PRIVATE_SUPERUSER_PASSWORD;
|
|
if (user == null || password == null)
|
|
{
|
|
throw new Error();
|
|
}
|
|
return proxyRequest(event, 'http://localhost:8089' + event.path, {
|
|
fetchOptions: {
|
|
headers: {
|
|
Authorization: "Basic " + Buffer.from(user + ':' + password).toString('base64')
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}) |