Initial commit: TopSysOps site + admin panel
Multi-page public site (Next.js), Node/Express backend with Postgres, and Vite admin/account app, restructured from a single-page layout into dedicated service, promotions, cases, about, FAQ, and blog pages for SEO. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013otXCiTZsxdZ4SJKZ9wUky
This commit is contained in:
commit
130c5382cd
108 files changed
+7146
No files matched your search
@@ -0,0 +1,26 @@
|
||||
// Используется только внутри Server Component'ов (во время SSR/сборки).
|
||||
// Обращается к бэкенду напрямую по внутреннему docker-адресу, минуя Caddy -
|
||||
// это работает только на сервере Next.js, у браузера такого адреса нет.
|
||||
const BASE = process.env.BACKEND_INTERNAL_URL || 'http://backend:4000';
|
||||
|
||||
async function get(path, { revalidate = 60 } = {}) {
|
||||
try {
|
||||
const res = await fetch(`${BASE}/api${path}`, { next: { revalidate } });
|
||||
if (!res.ok) return null;
|
||||
return res.json();
|
||||
} catch (err) {
|
||||
console.error(`[serverApi] failed to fetch ${path}`, err.message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export const serverApi = {
|
||||
getServices: () => get('/services').then((v) => v || []),
|
||||
getPromotions: () => get('/promotions').then((v) => v || []),
|
||||
getReviews: () => get('/reviews').then((v) => v || []),
|
||||
getCases: () => get('/cases').then((v) => v || []),
|
||||
getFaqs: () => get('/faqs').then((v) => v || []),
|
||||
getContact: () => get('/contact'),
|
||||
getBlogPosts: () => get('/blog').then((v) => v || []),
|
||||
getBlogPost: (slug) => get(`/blog/${slug}`, { revalidate: 60 }),
|
||||
};
|
||||
Reference in new issue
Block a user