Commit f1c0c87d authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

server-popular TMDB

parent adcfa91d
......@@ -3073,14 +3073,6 @@
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.2.3.tgz",
"integrity": "sha512-pXnVMfJKSIWU2Ml4JHP7pZEPIrgBO1Fd3WGx+fPBsS+KRGhE4vxooD8XBGWbQOIVSZsVK7pUDBBkCicNu80yzQ=="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"axobject-query": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
......
......@@ -7,7 +7,6 @@
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"bootstrap": "^5.0.2",
"bootstrap-icons": "^1.5.0",
"node-sass": "^6.0.1",
......@@ -40,5 +39,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"proxy": "http://localhost:3001"
}
import { useEffect } from "react"
import axios from "axios"
import baseUrl from '../../utils/baseUrl'
import React, { useState,useEffect } from "react"
import styles from "./box-office.module.scss"
const BoxOffice = () => {
const [TMDB_TopRated_Data, setTMDB_TopRated_Data] = useState()
useEffect(() => {
getTMDB_TopRated()
let items = document.querySelectorAll('.carousel .carousel-item')
console.log("item", items)
items.forEach((el) => {
console.log("el", el)
const minPerSlide = 4
let next = el.nextElementSibling
for (let i = 1; i < minPerSlide; i++) {
......@@ -21,7 +23,21 @@ const BoxOffice = () => {
})
}, [])
async function getTMDB_TopRated() {
try {
const response = await axios.get(`${baseUrl}/api/movie`)
console.log(response.data)
} catch (error) {
}
}
async function name() {
}
return (
<div className="container">
<h2 className="fw-bold text-white text-center mt-5">Box Office</h2>
<div id="multi-carousel" className={`d-flex carousel slide align-items-center ${styles.customHeight}`} data-bs-ride="carousel">
......
import clientConfig from './clientConfig'
const baseUrl = process.env.NODE_ENV === 'production'
? `http://localhost:3001/ ${clientConfig.serverRoot}`
: `http://localhost:3000`
export default baseUrl
\ No newline at end of file
const config = {
env: process.env.NODE_ENV === 'production' ? 'production' : 'development',
serverRoot: '/',
loginUser: 'butterStd-user',
}
export default config
\ No newline at end of file
......@@ -101,6 +101,14 @@
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
......@@ -601,6 +609,11 @@
"unpipe": "~1.0.0"
}
},
"follow-redirects": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg=="
},
"forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
......
......@@ -16,6 +16,7 @@
"author": "윤지원, 김수빈, 한규민",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"bcryptjs": "^2.4.3",
"cookie-parser": "^1.4.5",
"dotenv": "^10.0.0",
......
import express from 'express'
import cookieParser from 'cookie-parser'
import mainRouter from './routes/index.js'
import movieRouter from './routes/movie.route.js'
const app = express()
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
app.use(cookieParser())
app.use('/api', mainRouter)
export default app
\ No newline at end of file
import axios from 'axios'
const comparePopularMovie = async (req, res) => {
const response = await axios.get('https://api.themoviedb.org/3/movie/popular?api_key=1477348488076cafd4dcf973a314957d&language=ko-KR')
const movies = response.data
console.log('movies', movies)
try {
} catch (error) {
}
}
export default { comparePopularMovie }
\ No newline at end of file
import express from "express";
import movieRouter from './movie.route.js'
const router = express.Router();
router.use('/movie', movieRouter)
export default router;
\ No newline at end of file
import express from "express";
import movieCtrl from "../controllers/movie.controller.js";
const router = express.Router();
router
.route("/")
.post(movieCtrl.comparePopularMovie)
.get(movieCtrl.comparePopularMovie)
export default router;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment