Toggle navigation
Toggle navigation
This project
Loading...
Sign in
구희연
/
Food_recipe_info
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
윤희찬
2021-11-23 11:57:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
293e36b1a33ad33a26e91e43803acaeb04a89440
293e36b1
1 parent
479c1b41
Update router.js, main.html and main.js
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
main/main.html
main/main.js
router.js
main/main.html
View file @
293e36b
<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>
...
...
main/main.js
View file @
293e36b
...
...
@@ -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
}
...
...
router.js
View file @
293e36b
...
...
@@ -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
...
...
Please
register
or
login
to post a comment