Skip to content

Commit

Permalink
Updated code with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SahilMalavi committed Feb 16, 2025
1 parent 3ea56ec commit 7fe6b11
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BACKEND/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const app = express();
app.use(cors());
dotenv.config();

const port = process.env.PORT || 3001;
const port = process.env.PORT || 3096;

//mongodb connect
connectDB();
Expand Down
13 changes: 13 additions & 0 deletions FRONTEND/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions FRONTEND/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^1.7.9",
"dotenv": "^16.4.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.1",
Expand Down
3 changes: 2 additions & 1 deletion FRONTEND/src/components/BookList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Navbar from '../components/Navbar';
import Cards from '../components/Cards';
import axios from 'axios';

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;

function BookList() {
const [searchQuery, setSearchQuery] = useState('');
Expand All @@ -12,7 +13,7 @@ function BookList() {
useEffect(() => {
const getBooks = async () => {
try {
const res = await axios.get(`${process.env.API_BASE_URL}/book`);
const res = await axios.get(`${API_BASE_URL}/book`);
console.log(res.data);
setBooks(res.data);
setFilteredBooks(res.data); // Set filteredBooks initially to all books
Expand Down
4 changes: 2 additions & 2 deletions FRONTEND/src/components/YourBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import "slick-carousel/slick/slick-theme.css";
import Slider from "react-slick";
import Cards from './Cards';

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;

const YourBook = () => {

const [books, setBooks] = useState([]);

useEffect(() => {
const getBooks = async () => {
try {
const res = await axios.get(`${process.env.API_BASE_URL}/book`);
const res = await axios.get(`${API_BASE_URL}/book`);
console.log(res.data);
setBooks(res.data);
} catch (error) {
Expand Down

0 comments on commit 7fe6b11

Please sign in to comment.