app.listen(3000, () => console.log('Server started on port 3000'));
mongoose.connect('mongodb://localhost/pdf-library', { useNewUrlParser: true, useUnifiedTopology: true }); 56 bob ong pdf link
import React, { useState, useEffect } from 'react'; import axios from 'axios'; console.log('Server started on port 3000'))
app.get('/pdfs', async (req, res) => { const pdfs = await Pdf.find(); res.json(pdfs); }); { useNewUrlParser: true
useEffect(() => { axios.get('http://localhost:3000/pdfs') .then(response => setPdfs(response.data)) .catch(error => console.error(error)); }, []);