본문 바로가기

Language

(132)
[nodejs] [ Mongo DB ] mongoose를 이용해 mongoDB 사용하기 > 1. 연결하기 [출처] https://onemooon.tistory.com/entry/Node-JS-module-mongoose%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%B4-mongoDB%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EC%9E%90 기본적인 Mongoose 사용법을 차근차근 포스팅 하고자 한다. 연결하는데는 크게 문제 없었는데 warning 하나가 뜨면서 약간의 connection 수정을 여기에 적어보겠다. 일단 핵심 모듈인 mongoose 를 받는다 123const mongoose = require('mongoose'); //npm i mongoose --save || yarn add mongoose --savecs var 대신에 const를 쓰는 이유는 이..
new Date & ISO String ISO string로컬 브라우저 시간에 맞춘 변환 : new Date(ISO string)* GMT 이하 삭제 : new Date(ISO string).toString().split(" ").slice(0, 5).join(" ")* new Date to ISO String 변환 : new Date('바꾸고 싶은 날짜').toJSON()
How to vertically center a div for all browsers? body, html { background: #F5F5F5; box-sizing: border-box; height: 100%; margin: 0; } #center_container { align-items: center; display: flex; min-height: 100%; } #center { background: white; margin: 0 auto; padding: 10px; text-align: center; width: 200px; } I am center.
[nodejs] mongoose 커넥션 이벤트 함수 // CONNECTION EVENTS // When successfully connected mongoose.connection.on('connected', function () { console.log('Mongoose default connection open to ' + dbURI); }); // If the connection throws an error mongoose.connection.on('error',function (err) { console.log('Mongoose default connection error: ' + err); }); // When the connection is disconnected mongoose.connection.on('disconnected', functi..
Monitoring MongoDB connection status [출처] https://ramlez.com/blog/monitoring-mongodb-connection-status/[출처] https://ramlez.com/blog/monitoring-mongodb-connection-status/If you need to know what your MongoDB connection status is or when a database’s connection has dropped, timed out or some other error has occurred – this post will be useful to you. I don’t use any ODM packages like MongooseJS hence all examples cover the native Mon..
node.js express에서 CORS 허용하기 [출처] http://guswnsxodlf.github.io/enable-CORS-on-express[출처] http://guswnsxodlf.github.io/enable-CORS-on-express CORS란 무엇인가CORS란 Cross Origin Resource Sharing의 약자로, 현재 도메인과 다른 도메인으로 리소스가 요청될 경우를 말한다. 예를 들어, 도메인 http://A.com 에서 읽어온 HTML페이지에서 다른 도메인 http://B.com/image.jpg를 요청하는 경우를 말한다. 이런 경우에 해당 리소스는 cross-origin HTTP 요청에 의해 요청된다. 보안 상의 이유로, 브라우저는 CORS를 제한하고 있다.하지만 SPA(Single Page Application)의 경..
How to create a Drag and Drop file directive in angular2 with angular-cli [Part 1] [출처] https://scotch.io/@minrock/how-to-create-a-drag-and-drop-file-directive-in-angular2-with-angular-cli-part-1[출처] https://scotch.io/@minrock/how-to-create-a-drag-and-drop-file-directive-in-angular2-with-angular-cli-part-1IntroductionHi everyone, in this post we will build a Dran and drop directive with angular from a angular-cli scratch project.Firts of all, we need to install angular-cli on ..
data URIs로 image 생성하기 흔한 일은 아니지만 data URIs를 이용하여 html을 작성할 필요가 생기는 경우가 가끔있습니다. (이미 만들어진) 크기가 작은 이미지를 이미지 파일없이 html에 만들어 넣는다거나 하는 일 따위 말이죠.예를 들어 메일을 html로 작성할 때나 간단한 페이지를 작성해 임시로 사용할 html같은 경우에 필요할 수 있겠습니다. 요소의 src속성에 base64인코딩 방식으로 소스를 넣는 방식을 이용하는데, 기본적인 형식은 아래 같습니다.Syntax data:[][;base64], Sample data:,Hello%2C%20World! Simple text/plain data data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D base64-encoded version of ..