API(2)
-
async / await [ TIL ] [ node.js ]
Problem express 를 이용하여 간단한 게시판 api 를 만들던중 undefined 가 발생했다. Try router.post("/", async (req, res) => { console.log(req.body); try { const { title, content, userId } = postCreateValidation.validateAsync( req.body ); console.log(title, content, userId); const post = await Post.create({ title, content, userId, }); res.json(post); } catch (err) { if (err.isJoi) { return res.status(422).json({ messa..
2023.06.22 -
웹개발 종합반 2주차
스파르타 코딩클럽 웹개발 종합반 수업내용을 정리한 것입니다. Javascript 기초문법 1. console.log('') 버튼 - 브라우저에서 맥에 경우 command + option + i 단축키를 통해 console 창에서 볼 수 있어요 - 확인하려고 사용해요. 에러 확인을 위한 console.error() 도 있어요. 2. 변수 let a = 2; // 문자의 경우 let a = 'apple'; let b = 3; console.log(a+b); // 5 - 값을 담는 박스라고 생각하면 편해요. let a = ['사과', '수박', '딸기', '감']; console.log(a); // ['사과', '수박', '딸기', '감'] console.log(a[0]); // 사과 console.log(a..
2023.04.08