SeungJun Baek

라우팅 #1

......@@ -32,5 +32,6 @@ babel을 통해 내 최신js 코드를 호환성이 좋은 구 버전 js코드
/movies: 영화 보여주는 페이지
/movies/:id 영화 상세정보
/users/:id 사용자 상세정보
/users/likemovie 사용자가 좋아하는 영화 목록
\ No newline at end of file
......
export const home = (req,res)=>{
return res.send("hello this is homepage!");
}
export const join= (req,res) =>{
return res.send("hello this is joinpage!");
}
export const login = (req,res)=>{
return res.send("hello this is login!");
}
\ No newline at end of file
export const showMovies = (req,res) =>{
res.send("movies");
}
\ No newline at end of file
import express from "express";
import {home,join,login} from "../controllers/globalController"
const globalRouter = express.Router();
globalRouter.get('/',home);
globalRouter.get('/join',join);
globalRouter.get('/login',login);
export default globalRouter
\ No newline at end of file
import express from "express";
import { showMovies } from "../controllers/movieController";
const movieRouter = express.Router();
movieRouter.get('/',showMovies);
export default movieRouter;
\ No newline at end of file
import express from "express"
const app = express();
import global from "./routers/globalRouter";
import movies from "./routers/movieRouter";
const PORT = 3000
const app = express();
app.use('/',global);
app.use('/movies',movies);
app.listen(PORT,() => console.log(`The Server is running on http://localhost:${PORT} 🚀`))
\ No newline at end of file
app.listen(PORT,() => console.log(`The Server is running on http://localhost:${PORT}`));
......
{
"exec":"npx babel-node server.js"
"exec":"npx babel-node backend/server.js"
}
......