본문 바로가기

js11

user authentication 1: hash mongodb와 mongoose를 이용해서 User model을 만들고, join 페이지에서 필요 정보를 전달받아 User를 create했다. 터미널을 이용해 저장된 user collection을 확인하면 위처럼 정보를 확인할 수 있다. 하지만 사진처럼 사용자의 비밀번호가 드러나면 안되니 hashing을 이용할 필요가 있다. npm에서 설치 가능한 bcrypt를 이용해서 hashing하는 방법을 기록한다. 아래 링크를 참고하면 된다. https://www.npmjs.com/package/bcrypt bcrypt A bcrypt library for NodeJS.. Latest version: 5.1.0, last published: 4 months ago. Start using bcrypt in your.. 2023. 2. 20.
mongodb and mongoose 6: pre, middleware, static Video model의 정보 중 하나인 hashtag들을 #를 붙인 문자열의 배열으로 upload, update때마다 정리해야 한다. controller에 복사붙여넣기 말고, 함수를 만들어 활용하는 방법을 기록한다. 1. pre(mongoose's middleware) import mongoose from "mongoose"; const videoSchema = new mongoose.Schema({ title: { type: String, required: true, trim: true, maxLength: 30 }, description: { type: String, required: true, trim: true, maxLength: 100 }, createdAt: {type: Date, requi.. 2023. 2. 17.
mongodb and mongoose 1: mongoose로 mongodb 연결하기 먼저 아래 명령어를 통해 mongodb가 잘 설치되었는지 확인한다. mongod mongo 에러: zsh: command not found: mongo 아래 블로그를 통해 mongodb의 쉘을 설치하여 해결했다. https://velog.io/@jiminnote/zsh-command-not-found-mongo zsh: command not found: mongo =>몽고DB 설치하다가 생긴 장애물몽고DB 설치해결법 1.몽고디비 재실행 - 실패✅ 해결법 2. 성공 velog.io 그리고 현재 작업 중인 src 디렉토리에 db.js 파일을 만들고 아래 코드를 작성했다. import mongoose from "mongoose"; mongoose.set('strictQuery', false); mongoose.. 2023. 2. 14.
그림판 style 설정 input(type="range") 설정하는 방법은 아래를 참고했다. https://www.smashingmagazine.com/2021/12/create-custom-range-input-consistent-browsers/ Creating A Custom Range Input That Looks Consistent Across All Browsers — Smashing Magazine Range inputs have notoriously been a pain to style. Each browser renders the input differently requiring you to use vendor prefixes in order to create a cohesive look and feel. In.. 2023. 2. 5.