development -> main #1

Open
Christopher.Hase wants to merge 93 commits from development into main
Showing only changes of commit 85eb8470f5 - Show all commits

View file

@ -5,19 +5,22 @@ import { executeCommand } from './broker.js';
const app = express(); const app = express();
const port = 8090; const port = 8090;
//CORS aktivieren //app.use(cors());
app.use(cors()); // CORS aktivieren und den Origin explizit setzen
app.use(cors({
origin: 'http://localhost:8080', // Erlaubt Anfragen vom Frontend (localhost:8080)
methods: ['GET', 'POST', 'OPTIONS'], // Zulässige Methoden
allowedHeaders: ['Content-Type'], // Zulässige Header
credentials: true // Falls du Cookies oder Auth-Daten senden möchtest
}));
// Füge dies hinzu, um die OPTIONS-Anfragen korrekt zu behandeln // Füge dies hinzu, um die OPTIONS-Anfragen korrekt zu behandeln
//app.options('*', cors());
app.options('/api/command', cors()); // für eine bestimmte Route app.options('/api/command', cors()); // für eine bestimmte Route
// Verwende die Middleware, um POST-Body als JSON zu lesen // Verwende die Middleware, um POST-Body als JSON zu lesen
app.use(express.json()); app.use(express.json());
/*app.use(cors({
origin: 'http://localhost:8080'
}));*/
app.post('/api/command', (req, res) => { app.post('/api/command', (req, res) => {
executeCommand(); executeCommand();