56 Bob Ong Pdf Link
useEffect(() => { axios.get('http://localhost:3000/pdfs') .then(response => setPdfs(response.data)) .catch(error => console.error(error)); }, []);
import React, { useState, useEffect } from 'react'; import axios from 'axios'; 56 bob ong pdf link
const express = require('express'); const app = express(); const mongoose = require('mongoose'); useEffect(() => { axios
return ( <div> {pdfs.map(pdf => ( <div key={pdf.title}> <h2>{pdf.title}</h2> <p>Author: {pdf.author}</p> <a href={pdf.link} download>Download PDF</a> </div> ))} </div> ); } setPdfs(response.data)) .catch(error =>
app.listen(3000, () => console.log('Server started on port 3000'));
const pdfSchema = new mongoose.Schema({ title: String, author: String, publicationDate: Date, link: String });
app.get('/pdfs', async (req, res) => { const pdfs = await Pdf.find(); res.json(pdfs); });