This commit is contained in:
parent
85eb8470f5
commit
ce828cd5ef
1 changed files with 2 additions and 3 deletions
|
@ -8,7 +8,8 @@ const port = 8090;
|
||||||
//app.use(cors());
|
//app.use(cors());
|
||||||
// CORS aktivieren und den Origin explizit setzen
|
// CORS aktivieren und den Origin explizit setzen
|
||||||
app.use(cors({
|
app.use(cors({
|
||||||
origin: 'http://localhost:8080', // Erlaubt Anfragen vom Frontend (localhost:8080)
|
//origin: 'http://localhost:8080', // Erlaubt Anfragen vom Frontend (localhost:8080)
|
||||||
|
origin: 'https://192-168-197-2.c-one-infra.de',
|
||||||
methods: ['GET', 'POST', 'OPTIONS'], // Zulässige Methoden
|
methods: ['GET', 'POST', 'OPTIONS'], // Zulässige Methoden
|
||||||
allowedHeaders: ['Content-Type'], // Zulässige Header
|
allowedHeaders: ['Content-Type'], // Zulässige Header
|
||||||
credentials: true // Falls du Cookies oder Auth-Daten senden möchtest
|
credentials: true // Falls du Cookies oder Auth-Daten senden möchtest
|
||||||
|
@ -20,8 +21,6 @@ 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.post('/api/command', (req, res) => {
|
app.post('/api/command', (req, res) => {
|
||||||
executeCommand();
|
executeCommand();
|
||||||
res.status(200).send('Command executed\n');
|
res.status(200).send('Command executed\n');
|
||||||
|
|
Loading…
Reference in a new issue