import { useEffect, useState } from "react";
export default function Home() {
const [animeList, setAnimeList] = useState([]);
useEffect(() => {
fetch("http://localhost:5000/api/anime")
.then(res => res.json())
.then(data => setAnimeList(data));
}, []);
return (
);
}
const express = require("express");
const mongoose = require("mongoose");
const cors = require("cors");
const app = express();
app.use(cors());
app.use(express.json());
mongoose.connect("mongodb://127.0.0.1:27017/animeDB");
const Anime = mongoose.model("Anime", {
title: String,
image: String,
videoUrl: String
});
app.get("/api/anime", async (req, res) => {
const anime = await Anime.find();
res.json(anime);
});
app.listen(5000, () => console.log("Server running on port 5000"));
import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth";
const auth = getAuth();
const provider = new GoogleAuthProvider();
function login() {
signInWithPopup(auth, provider)
.then(result => console.log(result.user))
.catch(err => console.error(err));
}
Usopp Anime Hub 🎯
{animeList.map(anime => (
))}