Не получается зафетчить данные (js+php)

Залил на хостинг. При вызове функции getAllBooks() -

GET http://kast-test/api.php net::ERR_NAME_NOT_RESOLVED

js

async function getAllBooks(){

    const response = await fetch('http://kast-test.ru/api.php');
    if(!response.ok){
        console.log(response)
        return
    }
    let jsonResponse = await response.json();
    jsonResponse.forEach(element =>{

        let section = document.getElementById('mainSection')
        section.append(createBook(element.id, element.bookName, element.bookAuthor))

    })
}

api.php

<?php
include_once 'http://kast-test.ru/library.php';

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");



$books = new Cbooks;

if($_SERVER["REQUEST_METHOD"]=="GET") {
    $booksList = $products->index();

    if($booksList){
        http_response_code(200);

        echo json_encode($booksList);
    } else {
        http_response_code(404);
    }
}

library.php

<?php
class Cbooks {

    private $dbHost = 'localhost';
    private $dbUser = 'ci55045';
    private $dbPassword = 'Kast3228';
    private $dbName = 'ci55045_library1';

    public function index(){
        $mysqli = new mysqli($this->dbHost,$this->dbUser, $this->dbPassword, $this->dbName);

        if(mysqli_connect_errno()) {
            printf("Connection failed: %s\n", mysqli_connect_error());
            exit();
        }

        $query = "SELECT id, bookName, bookAuthor FROM books";

        if($result = $mysqli->query($query)){
            $row = $result->fetch_all(MYSQLI_ASSOC);
            $result->close();
        } else {
            $row = false;
        }

        $mysqli->close();
        return $row;
    }

}

Ответы (0 шт):