inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của neok

neok neok

@neok

Số lượng đánh giá đã viết
3
Xếp hạng trung bình
4.7

Bài viết 6

Hỏi & Đáp

500 server error

해결했습니다! nodebird-api v1쪽에서 에러가 있었나봐요. 감사합니다!

Lượt thích
0
Số bình luận
10
Lượt xem
15903

Hỏi & Đáp

500 server error

네 8001, 8002 제대로 작동하는데 8003/test만 안되네요,,

Lượt thích
0
Số bình luận
10
Lượt xem
15903

Hỏi & Đáp

500 server error

네 깃허브에 있는 코드 복사했는데도 그러네요ㅠㅠ 에러 처리는 되어있습니다. index.js const express = require ( 'express' ), axios = require ( 'axios' ); const router = express . Router (); router . get ( '/test' , async ( req , res , next ) => { try { if (! req . session . jwt ) { // 세션에 토큰이 없으면 const tokenResult = await axios . post ( 'http://localhost:8002/v1/token' , { clientSecret: process . env . CLIENT_SECRET , }); if ( tokenResult . data && tokenResult . data . code === 200 ) { // 토큰 발급 성공 req . session . jwt = tokenResult . data . token ; // 세션에 토큰 저장 } else { // 토큰 발급 실패 res . json ( tokenResult . data ); // 발급 실패 사유 응답 } } // 발급받은 토큰 테스트 const result = await axios . get ( 'http://localhost:8002/v1/test' , { headers: { authorization: req . session . jwt }, }); res . json ( result . data ); } catch ( error ) { console . error ( error ); if ( error . response . status === 419 ) { // 토큰 만료 시 res . json ( error . response . data ); } next ( error ); } }); module . exports = router ;

Lượt thích
0
Số bình luận
10
Lượt xem
15903

Hỏi & Đáp

return 여부

감사합니당!

Lượt thích
0
Số bình luận
2
Lượt xem
377

Hỏi & Đáp

webstorm에서 www파일

감사합니다! 전역 명령어들이 안먹혀서 폴더랑 파일을 일일이 만들어서 하다보니 그렇게 됐어요ㅠㅠ

Lượt thích
0
Số bình luận
2
Lượt xem
269

Hỏi & Đáp

matchedUrl 정의할 때

감사합니다! 이해했어요!

Lượt thích
0
Số bình luận
2
Lượt xem
321