added cors support and started chat client
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user