정의왕

Merge branch 'master' of http://khuhub.khu.ac.kr/2019102198/Tunnel into board

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
......@@ -3,7 +3,8 @@ const path = require("path");
const router = express.Router();
router.get('/',(req,res)=>{
res.sendFile(path.join(__dirname, '../../../turnel_FE/public/index.html'));
})
// res.sendFile(path.join(__dirname, '../../../turnel_FE/public/index.html'));
res.send("index");
});
module.exports = router;
\ No newline at end of file
......
......@@ -6,13 +6,15 @@ router.get('/',(req,res)=>{
res.send('로그인 페이지');
});
//라우트 매개변수사용
//뒤에 위치 요구
//후방 위치 요구
router.get("/:id",(req,res)=>{
console.log(req.params, req.query);
req.body;
console.log(req.body);
res.json({id:"oss_hi"});
});
module.exports = router;
\ No newline at end of file
......
......@@ -8,17 +8,18 @@ const bodyParser = require("body-parser");
dotenv.config();
const indexRouter = require('./routes/index.js');
const userRouter = require('./routes/login.js');
const loginRouter = require('./routes/login.js');
const registerRouter = require('./routes/regiser.js');
const app = express();
app.set('port', process.env.PORT || 3000);
app.set('port', process.env.PORT || 3001);
const port = app.get('port');
//미들웨어 설정
app.use(morgan('dev'));
app.use(express.json()); //json형식으로 데이터 전달
app.use(express.urlencoded({extende: false})); // url형식으로 형식으로 데이터 전달
app.use(bodyParser().json);
app.use(cookieParser(process.env.COOKIE_SECRET));
app.use(session({
resave: false,
......@@ -31,10 +32,13 @@ app.use(session({
name: 'session-cookie',
}));
//라우팅
app.use('/',indexRouter);
app.use('/login',userRouter);
app.use('/register',registerRouter);
//app.use('/',indexRouter);
//app.use('/login',loginRouter);
app.use('/',loginRouter); //로그인 페이지
app.use('/register',registerRouter); // 회원가입 페이지
//에러처리 미들웨어
......