Connectionsmongoose.connect('mongodb://localhost/myapp');mongoose.connect('mongodb://username:password@host:port/database?options...');ReplicaSet ConnectionsThe same method is used to connect to a replica set but instead of passing a single uri we pass a comma delimited list of uris.mongoose.connect('mongodb://username:password@host:port/database,mongodb://username:password@host:port,mongodb://u..
MongoDB는 처음 설치시 사용자 인증을 하지 않는다. 사용자 인증을 위한 방법은 2가지 이며 그 중 하나를 정리한다. MongoDB 서버를 실행 후 db.addUser("ID","PW")를 입력하면, 사용자를 추가, 변경 할 수 있다. 사용자 추가후 서버를 종료한다. 서버를 재시작할 때 mongod.exe --auth 입력하면 인증모드로 MongoDB 서버가 실행 된다. MongoDB 서버 실행 후 db.auth("ID",PW") 를 입력해서 인증을 한 후에 MongoDB 서버를 이용할 수 가 있다.
Installation$ npm install everyauthQuick StartIncorporate everyauth into your express app in just 2 easy steps.Choose and Configure Auth Strategies - Find the authentication strategy you desire in one of the sections below. Follow the configuration instructions.Add the Middleware to Express var everyauth = require('everyauth'); // Step 1 code goes here // Step 2 code var express = require('expre..
모듈 설치npm install redis 소스var _redis = require("redis"); var redis = _redis.createClient(포트, 아이피); redis.get('키', function(error, result) { if (error) console.log('Error: '+ error); else console.log('Name: ' + result);}); redis.set('키', Date(), function(error, result) { if (error) console.log('Error: ' + error); else console.log('Saved');});http://cooldragon.tistory.com/133
process#The process object is a global object and can be accessed from anywhere. It is an instance of EventEmitter.Event: 'exit'#Emitted when the process is about to exit. There is no way to prevent the exiting of the event loop at this point, and once all exit listeners have finished running the process will exit. Therefore you must only performsynchronous operations in this handler. This is a ..
EventEmitter는 말 그대로 이벤트를 발생시키는 모든 객체를 지칭한다. 서버에 접속(connect)할 때 이벤트가 발생하고 파일을 읽을 때 이벤트가 발생하는 식으로 이미 내장된 이벤트들이 존재할 것이고, 사용자 정의 이벤트를 만들 수도 있을 것이다. 참조 : Events > require('events') 첨부한다 > 이벤트를 발생시키는 모든 객체는 events.EventEmitter 의 인스턴스 > 이벤트 발생할 때 실행할 함수를 객체에 연결, 이러한 함수를 리스너(Listener)라고 부른다 > EventEmitter 접근 : require('events').EventEmitter> emitter.on(event, listener) 또는 emitter.addListener(event, list..
- Total
- Today
- Yesterday