@kozojs/cli 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +3 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1496,11 +1496,12 @@ ${auth ? "JWT_SECRET=change-me-to-a-random-secret-at-least-32-chars\n" : ""}`;
1496
1496
  ` : "";
1497
1497
  const servicesSetup = "\nconst services = {};\n";
1498
1498
  const authMiddleware = auth ? `
1499
- // JWT protects all /api/* routes except /api/auth/*
1499
+ // JWT protects all /api/* routes except public ones
1500
1500
  const JWT_SECRET = process.env.JWT_SECRET || 'change-me';
1501
1501
  const _jwt = authenticateJWT(JWT_SECRET, { prefix: '' });
1502
+ const publicPaths = ['/api/auth/', '/api/health', '/api/stats'];
1502
1503
  app.getApp().use('/api/*', (c, next) => {
1503
- if (c.req.path.startsWith('/api/auth/')) return next();
1504
+ if (publicPaths.some(p => c.req.path.startsWith(p))) return next();
1504
1505
  return _jwt(c, next);
1505
1506
  });
1506
1507
  ` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kozojs/cli",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "CLI to scaffold new Kozo Framework projects - The next-gen TypeScript Backend Framework",
5
5
  "bin": {
6
6
  "create-kozo": "./lib/index.js",