Showing
15 changed files
with
95 additions
and
15 deletions
... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
4 | 4 | ||
5 | 영화 사이트 만들기 | 5 | 영화 사이트 만들기 |
6 | 6 | ||
7 | -사용 API: https://yts.torrentbay.to/api | 7 | +사용 API: https://yts.mx/ |
8 | 8 | ||
9 | 사용 데이터베이스(예비) mongo DB | 9 | 사용 데이터베이스(예비) mongo DB |
10 | 10 | ||
... | @@ -25,13 +25,25 @@ babel을 통해 내 최신js 코드를 호환성이 좋은 구 버전 js코드 | ... | @@ -25,13 +25,25 @@ babel을 통해 내 최신js 코드를 호환성이 좋은 구 버전 js코드 |
25 | 25 | ||
26 | ⚡라우팅⚡ | 26 | ⚡라우팅⚡ |
27 | 27 | ||
28 | -/ -> 홈 페이지 | 28 | +- [✔] / -> 홈 페이지 |
29 | 29 | ||
30 | -/join -> 회원가입 | 30 | +- [✔] /join -> 회원가입 |
31 | -/login -> 로그인 | 31 | +- [✔] /login -> 로그인 |
32 | 32 | ||
33 | -/movies: 영화 보여주는 페이지 | 33 | +- [✔] /movies: 영화 보여주는 페이지 |
34 | -/movies/:id 영화 상세정보 | 34 | +- [✔] /movies/:id 영화 상세정보 |
35 | +- [] /movies/:id 에 정규표현식 적용하기 | ||
35 | 36 | ||
36 | -/users/:id 사용자 상세정보 | ||
37 | -/users/likemovie 사용자가 좋아하는 영화 목록 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
37 | +- [✔] /users/:id 사용자 상세정보 - | ||
38 | +- [✔] /users/likemovie 사용자가 좋아하는 영화 목록 | ||
39 | + | ||
40 | + | ||
41 | +pug뷰 만들기 | ||
42 | + | ||
43 | + | ||
44 | +컨트롤러만들기 | ||
45 | + | ||
46 | + | ||
47 | +영화 디비 활용하기 | ||
48 | + | ||
49 | +몽고 db 쓰기 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff could not be displayed because it is too large.
... | @@ -16,6 +16,9 @@ | ... | @@ -16,6 +16,9 @@ |
16 | }, | 16 | }, |
17 | "dependencies": { | 17 | "dependencies": { |
18 | "babel-loader": "^8.2.5", | 18 | "babel-loader": "^8.2.5", |
19 | - "express": "^4.18.1" | 19 | + "dotenv": "^16.0.1", |
20 | + "express": "^4.18.1", | ||
21 | + "node-fetch": "^2.6.1", | ||
22 | + "pug": "^3.0.2" | ||
20 | } | 23 | } |
21 | } | 24 | } | ... | ... |
src/backend/controllers/movieController.js
0 → 100644
1 | +import fetch from "node-fetch" | ||
2 | + | ||
3 | +const getMovies = async ()=>{ | ||
4 | + const BASEURL = `https://yts.mx/api/v2/list_movies.json`; | ||
5 | + const movies = await fetch(BASEURL,{ | ||
6 | + | ||
7 | + }); | ||
8 | + console.log(movies); | ||
9 | +} | ||
10 | + | ||
11 | +export const showMovies = (req,res) =>{ | ||
12 | + //getMovies(); | ||
13 | + res.send("movie home"); | ||
14 | +} | ||
15 | + | ||
16 | +export const movieInformation = (req,res)=>{ | ||
17 | + res.send("movie detail"); | ||
18 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/backend/controllers/usersController.js
0 → 100644
1 | import express from "express"; | 1 | import express from "express"; |
2 | -import { showMovies } from "../controllers/movieController"; | 2 | +import { showMovies, movieInformation } from "../controllers/movieController"; |
3 | 3 | ||
4 | const movieRouter = express.Router(); | 4 | const movieRouter = express.Router(); |
5 | 5 | ||
6 | movieRouter.get('/',showMovies); | 6 | movieRouter.get('/',showMovies); |
7 | 7 | ||
8 | +movieRouter.get('/:id', movieInformation); | ||
9 | + | ||
8 | export default movieRouter; | 10 | export default movieRouter; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/backend/routers/userRouter.js
0 → 100644
1 | +import express from "express"; | ||
2 | +import { userId, userLikemovie } from "../controllers/usersController"; | ||
3 | + | ||
4 | +const userRouter = express.Router(); | ||
5 | + | ||
6 | +userRouter.get('/:id(\\d+)', userId); | ||
7 | +userRouter.get('/likemovie', userLikemovie); | ||
8 | + | ||
9 | +export default userRouter | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | import express from "express" | 1 | import express from "express" |
2 | import global from "./routers/globalRouter"; | 2 | import global from "./routers/globalRouter"; |
3 | import movies from "./routers/movieRouter"; | 3 | import movies from "./routers/movieRouter"; |
4 | +import users from "./routers/userRouter"; | ||
4 | 5 | ||
5 | const PORT = 3000 | 6 | const PORT = 3000 |
6 | const app = express(); | 7 | const app = express(); |
8 | + | ||
9 | +app.set('view engine',"pug"); | ||
10 | +app.set("views",process.cwd() +"/src/views"); | ||
7 | app.use('/',global); | 11 | app.use('/',global); |
8 | app.use('/movies',movies); | 12 | app.use('/movies',movies); |
13 | +app.use('/users',users) | ||
9 | 14 | ||
10 | app.listen(PORT,() => console.log(`The Server is running on http://localhost:${PORT}`)); | 15 | app.listen(PORT,() => console.log(`The Server is running on http://localhost:${PORT}`)); | ... | ... |
src/views/home.pug
0 → 100644
src/views/layout.pug
0 → 100644
1 | +doctype html | ||
2 | +html(lang="en") | ||
3 | + head | ||
4 | + meta(charset="UTF-8") | ||
5 | + meta(http-equiv="X-UA-Compatible", content="IE=edge") | ||
6 | + meta(name="viewport", content="width=device-width, initial-scale=1.0") | ||
7 | + link(rel="stylesheet" href="http://unpkg.com/mvp.css") | ||
8 | + title=siteTitle | ||
9 | + body | ||
10 | + include ./partials/header | ||
11 | + main | ||
12 | + block content | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment