This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var params = qs.parse(url.parse(req.url).query) | |
, id = params.id | |
, BreakException = {}; | |
try { | |
tweets.forEach(function(element, index) { | |
if(element.id == id) { | |
res.send({tweets:tweets.slice(index+1, index+21)}); | |
throw BreakException; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* express 처음에 init 하시면 app.js 를 비롯하여 여러 디렉토리가 생기는데 | |
* logs 디렉토리에 아무것도 안남는다고 의문을 가지신 분에게 도움이 될거 같습니다. | |
* connect의 middleware logger 는 기본이 stdout 으로 출력하고 있었네요. | |
* http://senchalabs.github.com/connect/middleware-logger.html | |
* manual을 살펴보니 stream options 이 있었군요. | |
* 한번 생각나서 fs core module의 createWriteStream 을 사용하여 해봤더니 잘되네요. | |
* 다른 방법도 있으신분은 알려주세요 | |
*/ | |
var fs = require('fs'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
site1 = express.createServer(), | |
site2 = express.createServer(), | |
site_vhosts = [], | |
vhost; | |
site_vhosts.push(express.vhost('domain1.com', site1)); | |
site_vhosts.push(express.vhost('domain2.com', site2)); | |
vhost = express.createServer.apply(this, site_vhosts); |
NewerOlder