using app router api and fetching it in server component now cannot build the app?
Unanswered
Yellowfin tuna posted this in #help-forum
Yellowfin tunaOP
as my local host is now running how do i build the app
1 Reply
Yellowfin tunaOP
ts import api from "@/axios/instance";
import styles from "@/components/homepage/home.module.css";
import Image from "next/image";
const HeroSection = async () => {
const banner = await fetchBanner();
return (
<>
<div className={styles.hero}>
<Image
src={banner.image_url}
alt={banner.name}
priority={false}
width={1500}
height={400}
/>
</div>
</>
);
};
const fetchBanner = async () => {
try {
const res = await api.get("/banner/homepage-hero");
return res.data;
} catch (error) {
console.error("Error fetching banner", error);
}
};
export default HeroSection;