Skip to content

Commit 8920207

Browse files
committed
fix:workspace shared package + production build config
1 parent 540676b commit 8920207

20 files changed

Lines changed: 159 additions & 728 deletions

File tree

api-gateway/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"dev": "tsx watch src/server.ts",
9-
"start": "tsx src/server.ts",
9+
"start": "node dist/server.js",
1010
"build": "tsc"
1111
},
1212
"keywords": [],
@@ -19,7 +19,8 @@
1919
"express": "^5.2.1",
2020
"http-proxy-middleware": "^3.0.5",
2121
"jsonwebtoken": "^9.0.3",
22-
"pg": "^8.18.0"
22+
"pg": "^8.18.0",
23+
"@h-os/shared": "workspace:*"
2324
},
2425
"devDependencies": {
2526
"@types/bcrypt": "^6.0.0",

api-gateway/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const app = express();
1313

1414
app.use(
1515
cors({
16-
origin: 'http://localhost:3000',
16+
origin: process.env.ALLOWED_ORIGINS?.split(','),
1717
credentials: true,
1818
})
1919
);

api-gateway/src/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import baseLogger from '../../services/shared/src/logger';
1+
import baseLogger from '@h-os/shared';
22

33
const logger = baseLogger.child({
44
service: 'api-gateway',

api-gateway/src/middlewares/auth.middleware.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Request, Response, NextFunction } from 'express';
22
import jwt from 'jsonwebtoken';
33
import { error } from 'node:console';
44

5-
console.log('JWT_SECRET in gateway:', process.env.JWT_SECRET);
5+
// console.log('JWT_SECRET in gateway:', process.env.JWT_SECRET);
66

77
export interface AuthenticatedRequest extends Request {
88
user?: {
@@ -25,25 +25,18 @@ export function authenticate(
2525
) {
2626
const authHeader = req.headers.authorization;
2727

28-
console.log('AUTH HEADER:', authHeader);
29-
3028
if (!authHeader?.startsWith('Bearer ')) {
3129
return res.status(401).json({ error: 'Unauthorized' });
3230
}
3331

3432
const token = authHeader.split(' ')[1];
3533

36-
console.log('TOKEN LENGTH:', token.length);
37-
console.log('TOKEN PREVIEW:', token.slice(0, 20));
38-
3934
try {
4035
const payload = jwt.verify(
4136
token,
4237
process.env.JWT_SECRET!
4338
) as AuthenticatedRequest['user'];
4439

45-
console.log('JWT PAYLOAD:', payload);
46-
4740
req.user = payload;
4841
next();
4942
} catch (err: any) {

api-gateway/tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"extends": "../tsconfig.base.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"outDir": "dist",
6+
"rootDir": "src",
7+
"module": "CommonJS",
8+
"moduleResolution": "Node"
9+
},
310
"include": ["src"]
411
}

frontend/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
4+
output: 'standalone',
55
};
66

77
export default nextConfig;

0 commit comments

Comments
 (0)