분류 전체보기
-
ESModule 로 express 작성하기백엔드/express.js 2024. 5. 17. 16:51
{ "name": "webrtc", "version": "1.0.0", "description": "", "main": "server.mjs", // 확장자 변경 "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "nodemon ./src/server.mjs" // 명령어 작성 }, "author": "", "license": "ISC", "dependencies": { "express.js": "^1.0.0", "pug": "^3.0.2" }, "type": "module" // 추가}ESModule 을 사용하기 위해서는 "type": "module" 을 설정해야 한다. 또한, ..
-
비주얼 스튜디오 코드 (vsc)에서 리액트 사용시 Emmet 적용하기프론트엔드/React 2024. 5. 17. 10:34
File -> Preferences -> Settings 로 이동한다.Workspace 탭에서 Extensions 메뉴를 열고, Emmet 을 선택한다.Preferences 에서 Edit in settings.json 링크를 클릭한다.{ "emmet.preferences": { }, "emmet.includeLanguages": { "javascript": "javascriptreact" }}settings.json 파일에 위와 같이 작성하고, 비주얼 스튜디오 편집기를 끄고 재시작한다.
-
이미지 업로드 - multer백엔드/express.js 2024. 5. 16. 17:34
https://medium.com/@hassaanistic/image-handeling-using-multer-in-react-d7fea28e8dc6 multer 를 이용하여 이미지를 업로드하는 방법은 두가지가 있다. 첫번째는 이미지를 서버로 전송하면 특정폴더에 저장하고, 폴더에 저장된 이미지 데이터를 DB에 저장하고, 브라우저로 이미지 데이터를 보낸다. 두번째는 이미지를 서버로 전송하면 특정폴더에 저장하고, 폴더에 저장된 이미지 경로를 브라우저로 전송하고, 브라우저에서 해당경로의 파일 데이터를 읽는 방식이다. 즉, 브라우저로 이미지 데이터를 보내느냐, 이미지 경로를 보내느냐의 차이다. 또는 서버쪽에서 이미지 데이터를 조회하느냐 프론트쪽에서 이미지 데이터를 조회하느냐의 차이다. 아래 코드는 두번째 방법..
-
여러 뎁스의 reference 에 대하여 populate 하기데이터베이스 2024. 5. 16. 13:03
https://mongoosejs.com/docs/populate.html= 3.2. Mongoose has a more powerful alternative called populate(), which lets you reference documents in other collections. Population is the process of automatically replacing th" data-og-host="mongoosejs.com" data-og-source-url="https://mongoosejs.com/docs/populate.html" data-og-url="https://mongoosejs.com/docs/populate.html" data-og-image="https://scra..
-
노드 cors 에러 해결하기 - Error: unable to verify the first certificate백엔드/express.js 2024. 5. 16. 11:06
https://velog.io/@satoshi25/TIL-714-Warning-Setting-the-NODETLSREJECTUNAUTHORIZED-environment TIL 7/14 Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment오늘은 시험을 봤다. 그 중에서 잘 몰랐던 부분들을 찾아보면서 나름 문제의 원인을 찾은 경험을 남겨봤다. https 모듈을 사용하여 express로 api 문서대로 구현하는 것이 목표였다. 시험의 문제와는velog.io * 노드 서버 https 설정하기https://charming-kyu.tistory.com/46 [node.js] localhost https 적용 (SSL)서론 로컬에서 개발할 때 http://l..
-
업데이트 추가문제 해답데이터베이스 2024. 4. 24. 13:08
연습과제 7 db.movies.updateMany({}, [ { $set: { info: ["$year", "$rating", "$runtime"] }} ])연습과제 8db.movies.updateMany({}, { $unset: { mpa_rating: 1 } })연습과제 9db.movies.updateOne({ id: 61230 }, { $set: { "torrents.1.url": "url 수정함" }})연습과제 10db.movies.updateMany({}, [ { $set: { "torrents.seeds": "$runtime", "torrents.peers": "$year" } }] )연습과제 11db.movies.updateMany({ runtime: { $mod: ..
-
몽고 DB 쿼리 - 연습과제데이터베이스 2024. 4. 23. 14:43
연습과제 1 db.movies.find({ title: { $regex: /er/ }}).count() 연습과제 2 db.movies.find( { year: { $gt: 2020 }}).count() 연습과제 3 db.movies.find({ year: { $gte: 2005, $lte: 2007 }}).count() 연습과제 4 db.movies.find({ genres: { $in: ["Comedy", "Horror"] }}).count() 연습과제 5 db.movies.find({ runtime: { $mod: [5, 0] }}).count() 연습과제 6 db.movies.find({ $and: [{ rating: { $gt: 7 } }, { year: { $gt: 2020 } }] }).cou..
-
함수와 this프론트엔드/Javascript 2024. 4. 20. 08:53
function 으로 생성한 함수에는 항상 this 와 prototype 속성이 존재한다. const Shadow = function(){ console.log(this) } console.log(Shadow()) this 는 윈도우 객체이다. console.log(new Shadow()) this 는 생성자함수이다. var Human = function(type){ this.type = type || 'human' } Human.isHuman = function(human){ return human instanceof Human } Human.prototype.breathe = function(){ alert('h-a-a-a-m') } 자바스크립트에서는 객체 복사로 상속한다. 복사하는 원본객체를 프로토..