movie.controller.js 729 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import axios from 'axios'
2
3
import { Movie } from "../db/index.js";

Jiwon Yoon's avatar
Jiwon Yoon committed
4
5
6
7
8
9
10
11
12
13
14
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) {

    }
}

15
16
17
18
19
20
21
22
23
24
25
26
27
28
const create = async (req, res) => {
    try {
        const { movieId } = req.params
        const newMovie = await Movie.create({ movieId: movieId });
        return res.json(newMovie);
    } catch (error) {
        return res.status(500).send(error.message || "영화 등록 중 에러 발생");
    }
}

export default {
    comparePopularMovie,
    create,
}