export default defineEventHandler(async (event) => {
    const { public: { apiBase } } = useRuntimeConfig();

    const query = getQuery(event);
    let category = query.hasOwnProperty('category') ? `categoryId=${query.category}` : '';
    let page = query.hasOwnProperty('page') ? `page=${query.page}` : '';
  // let sortBy = query.hasOwnProperty('sortBy') ? `price=${query.price}` : '';
    let price = query.hasOwnProperty('price') ? `price=${query.price}` : '';
    let name = query.hasOwnProperty('name') ? `name=${query.name}` : '';
    try {
        const data = await $fetch(`${apiBase}/course?${category}&${page}&pageSize=100&${price}&${name}`, {
            method: 'GET',
            headers: {
                'Accept': 'application/json',
                'content-type': 'application/json'

            }
        });
        return data;
    } catch (error) {
        return error;
    }

});