added cors support and started chat client

This commit is contained in:
Storme-bit
2026-04-06 03:25:25 -07:00
parent 461438e81b
commit 1e2ce7a761
16 changed files with 2610 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
},
"dependencies": {
"@nexusai/shared": "^1.0.0",
"cors": "^2.8.6",
"dotenv": "^17.4.0",
"express": "^5.2.1",
"node-fetch": "^2.7.0"

View File

@@ -3,12 +3,22 @@ const express = require('express');
const {getEnv} = require('@nexusai/shared');
const chatRouter = require('./routes/chat');
const sessionsRouter = require('./routes/sessions');
const cors = require('cors');
const app = express();
app.use(express.json());
const PORT = getEnv('PORT', '4000'); // Default to 4000 if PORT is not set
app.use(cors({
origin: [
getEnv('CORS_ORIGIN', 'http://localhost:5173'),
'http://localhost:5173',
],
methods: ['GET', 'POST', 'DELETE'],
allowedHeaders: ['Content-Type'],
}))
// Health check endpoint
app.get('/health', (req, res) => {
res.json({