윤희찬

Update router.js, main.html and main.js

<style type='text/css'>
@import url("style.css");
</style>
<!DOCTYPE html>
<html lang="en">
......@@ -30,4 +27,4 @@
</section>
<script src="./main.js"></script>
</body>
</html>
\ No newline at end of file
</html>
......
......@@ -14,7 +14,7 @@ searchForm.addEventListener('submit', function(event){
});
async function fetchAPI(){
const recipeURL = `https://api.edamam.com/search?q=${searchQuery}&app_id=${APP_ID}&app_key=${APP_KEY}`;
const recipeURL = `https://api.edamam.com/search?q=pizza&app_id=${APP_ID}&app_key=${APP_KEY}`;
const response = await fetch(recipeURL);
const data = await response.json();
boxinfo(data.hits);
......@@ -37,4 +37,4 @@ function boxinfo(results){
`
})
searchResultDiv.innerHTML = boxsinfo;
}
\ No newline at end of file
}
......
......@@ -3,18 +3,18 @@ const router = express.Router()
const fs=require('fs')
const passport = require('./passport.js')
const path = require('path');
router.get('/', (req, res) => {
res.render('index', {title: "인덱스"})
})
//로그인창
router.post('/', passport.authenticate('local-login', {
successRedirect : '/loginSuccess',
failureRedirect : '/loginFail',
failureFlash : true
successRedirect : '/loginSuccess',
failureRedirect : '/loginFail',
failureFlash : true
}))
//로그인성공
router.get('/loginSuccess', (req, res) => {
res.render('loginSuccess')
......@@ -25,9 +25,13 @@ router.get('/loginFail', (req, res) => {
res.render('loginFail')
})
//Express에서 정적파일(ex: main.html, main.js)들을 사용할경우
//경로를 미리 제시해 주는 부분
router.use(express.static(__dirname + '/main'));
//메인화면
router.get('/main', (req, res)=>{
res.sendFile(path.join(__dirname+'/main/main.html'));
})
module.exports = router
\ No newline at end of file
module.exports = router
......