added cors support and started chat client
This commit is contained in:
@@ -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