This commit is contained in:
seb
2026-09-29 11:31:35 +02:00
parent cf4af1480b
commit 0e64233418
5 changed files with 253 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ const root = path.resolve(__dirname, '..');
const docsDir = path.join(root, 'docs', 'api');
const routesDocsDir = path.join(docsDir, 'routes');
const PUBLIC_PATHS = new Set(['/auth/login', '/auth/logout', '/health']);
const PUBLIC_PATHS = new Set(['/auth/login', '/auth/logout', '/health', '/v1/client']);
const options = {
definition: {
@@ -26,10 +26,14 @@ const options = {
'Browser clients must send cookies (`credentials: \'include\'`). ' +
'Sessions use an HTTP-only `token` cookie (`Secure`, `SameSite=Strict`, 24h); HTTPS is required for login.',
},
servers: [{ url: 'http://localhost:4208/api', description: 'Local default (PORT / .env)' }],
servers: [
{ url: 'http://localhost:4208/api', description: 'Local default HTTP (PORT / .env)' },
{ url: 'https://localhost:8443', description: 'Local default HTTPS (HTTPS_PORT / .env)' },
],
tags: [
{ name: 'Auth', description: 'Google SSO and session' },
{ name: 'Health', description: 'Connectivity checks' },
{ name: 'POS', description: 'POS bind and sync API (/v1)' },
{ name: 'Events', description: 'SSE update signals for live clients' },
{ name: 'Article', description: 'Articles under categories' },
{ name: 'Category', description: 'Category tree and membership' },
@@ -55,6 +59,7 @@ const options = {
apis: [
path.join(root, 'src/api/openapi.js'),
path.join(root, 'src/api/routes/**/*.js'),
path.join(root, 'src/v1/**/*.js'),
],
};
@@ -352,6 +357,8 @@ function renderReadme(operations) {
lines.push('');
lines.push('```');
lines.push('http://localhost:4208/api');
lines.push('https://localhost:8443/api');
lines.push('https://localhost:8443/v1 (POS API)');
lines.push('```');
lines.push('');
lines.push('## CORS & cookies');