mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-25 08:26:22 +02:00
mv experimental apps
This commit is contained in:
parent
7f6ece90f8
commit
f722591ccd
53 changed files with 31 additions and 31 deletions
27
apps/experimental/chat_widget/app/api/bootstrap.js/route.ts
Normal file
27
apps/experimental/chat_widget/app/api/bootstrap.js/route.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
export const dynamic = 'force-dynamic'
|
||||
|
||||
// Fetch template once when module loads
|
||||
const templatePromise = fetch(process.env.CHAT_WIDGET_HOST + '/bootstrap.template.js')
|
||||
.then(res => res.text());
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
// Reuse the cached content
|
||||
const template = await templatePromise;
|
||||
|
||||
// Replace placeholder values with actual URLs
|
||||
const contents = template
|
||||
.replace('__CHAT_WIDGET_HOST__', process.env.CHAT_WIDGET_HOST || '')
|
||||
.replace('__ROWBOAT_HOST__', process.env.ROWBOAT_HOST || '');
|
||||
|
||||
return new Response(contents, {
|
||||
headers: {
|
||||
'Content-Type': 'application/javascript',
|
||||
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error serving bootstrap.js:', error);
|
||||
return new Response('Error loading script', { status: 500 });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue