728x90

프로젝트/할일목록(TODO) 앱 8

할일목록(TODO) 앱 8 - 사용량(트래픽) 제한 구현하기

* 주의할점 : 앞서 virtual 필드 추가한 코드가 반영이 안되어 있을수 있음  토큰을 발급받은 사용자라고 하더라도 API서버에 무리를 줄만큼 과도한 트래픽을 발생하도록 허용하는 것은 좋지 않다. 그렇기 때문에 일정시간동안 API 사용횟수를 제한하여 서버의 트래픽을 제한하는 것이 좋다. 예를 들어 무료로 서비스를 이용하는 사용자는 하루에 50번으로 제한하고 유료 사용자는 하루에 500번으로 제한하는 것이다. npm install express-rate-limit사용량(트래픽) 제한에 대한 구현을 위하여 위 패키지를 설치한다.{ "name": "server", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { ..

할일목록(TODO) 앱 7 - Mongoose virtual 과 moment.js 로 현재 시각 기준으로 시간 표시하기

https://jsikim1.tistory.com/195 moment.js 사용 방법 - JavaScript 날짜 라이브러리moment.js 사용 방법 - JavaScript 날짜 라이브러리 moment.js는 JavaScript에서 사용되는 날짜관련 라이브러리 중 가장 많이 사용되었던 라이브러리입니다. 현재는 더이상의 업데이트가 없을 것이라 하였jsikim1.tistory.comhttps://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose Express Tutorial Part 3: Using a Database (with Mongoose) - Learn web development | MDNIn this articl..

할일목록(TODO) 앱 6 - 데이터 검증하기 (validation)

* Mogoose validate 메서드로 DB 저장 이전에 데이터 형식 검증하기 https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.validate() Mongoose v8.3.3: SchemaTypeParameters: SchemaType constructor. Do not instantiate SchemaType directly. Mongoose converts your schema paths into SchemaTypes automatically. Example: const schema = new Schema({ name: String }); schema.path('name') instanceof SchemaType; // t..

할일목록(TODO) 앱 5 - chart.js 로 그룹핑한 데이터 그래프로 그리기

https://www.chartjs.org/docs/latest/getting-started/ Getting Started | Chart.jsGetting Started Let's get started with Chart.js! Alternatively, see the example below or check samples. Create a Chart In this example, we create a bar chart for a single dataset and render it on an HTML page. Add this code snippet to your page: You shouldwww.chartjs.orghttps://www.chartjs.org/docs/latest/general/colo..

할일목록(TODO) 앱 4 - API 설계 및 구현

* 기능정의 회원가입로그인로그아웃사용자정보 변경사용자정보 삭제todo 생성 (해당 사용자 기준)todo 목록조회 (해당 사용자 기준)todo 조회 (해당 사용자 기준)todo 변경 (해당 사용자 기준)todo 삭제 (해당 사용자 기준) * API 설계HTTP 메서드는 흔히 CRUD(Creat, Read, Update, Delete) 라고 하며, REST API 에서는 GET(데이터 조회), POST(데이터 생성), PUT(데이터 변경), DELETE(데이터 삭제) 를 기본적으로 수행한다. 아래와 같은 URL 주소를 Rest API 엔드포인트라고 한다. User 모델관련URLURL 설명HTTP 메서드/api/users/register회원가입POST/api/users/login로그인POST/api/users..

할일목록(TODO) 앱 3 - Mongoose 로 데이터 모델 설계 및 구현하기

https://mongoosejs.com/ Mongoose ODM v7.4.2Let's face it, writing MongoDB validation, casting and business logic boilerplate is a drag. That's why we wrote Mongoose. const mongoose = require('mongoose'); mongoose.connect('mongodb://127.0.0.1:27017/test'); const Cat = mongoose.model('Cat', { name:mongoosejs.com * 데이터 모델 설계 - Todo필드명설명데이터 타입비고author할일을 작성한 작성자ObjectId ref: 'User'title할일에 대한 제목Stri..

할일목록(TODO) 앱 1 - 서버 셋팅 및 Mongo DB 연동

* Node.js 설치 설치 사이트 다운로드 | Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. nodejs.org LTS버전 Windows Installer (.msi) 64bit 다운로드 * 프로젝트 구조 - 서버 todo - server - index.js - src - package.json - .gitignore - .git node_modules .gitignore 파일 * github 셋팅 윈도우 git 설치 가이드 [Git (1)] 윈도우 10 Git 설치 하기 [Git (1)] 윈도우 10 Git 설치 하기 안녕하세요. 갓대희 입니다. 이번 포스팅은 [ Window 10 Git 설치 방법 ] ..

728x90