I'm trying to get only "Test" response from a PHP file with ReactJS and Axios. But get whole code from rest.php instead of "Test".
When i try to access localhost/rest.php only get "Test" word and PHP is working good.
What i'm doing wrong?
Thanks
app.jsx
import React, { Component } from 'react';
import './App.css';
import axios from 'axios';
class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }
  componentDidMount() {
    const url = './api/rest.php'
        axios.get(url)
      .then(res => {
        const persons = res.data;
        this.setState({ contacts: persons });
      })
  }
  render() {
    return (
      <div style={{ width: "100%", height: "100vh" }}>
          {this.state.contacts}
      </div>
    )
  }
}
export default App;
and rest.php
    header("Access-Control-Allow-Origin: *");
        $data = json_decode(file_get_contents("php://input"), true);
    $host = "localhost"; 
    $user = "root"; 
    $password = ""; 
    $dbname = "musteri"; 
    //$con = mysqli_connect($host, $user, $password,$dbname);
    echo "test";
 
     
    