Skip to content

Instantly share code, notes, and snippets.

@ppillip
Created March 21, 2012 06:10
Show Gist options
  • Save ppillip/2145097 to your computer and use it in GitHub Desktop.
Save ppillip/2145097 to your computer and use it in GitHub Desktop.
GGUM
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes');
var app = module.exports = express.createServer();
var Mongolian = require("mongolian");
var server = new Mongolian("localhost");
var db = server.db("EDMsl");
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler());
});
// Routes
app.get('/service/selectAllDocument', function(req, res) {
var document = db.collection("xr_document");
var nParam = {};
if(!!req.param("FOLDER_ID")) nParam["folderList.FOLDER_ID"] = req.param("FOLDER_ID");
if(!!req.param("IS_CURRENT")) nParam["IS_CURRENT"] = req.param("IS_CURRENT");
if(!!req.param("DOC_ID")) nParam["DOC_ID"] = req.param("DOC_ID");
console.log("noSql:"+JSON.stringify(nParam));
document.find(nParam,{ _id:0 }).sort({"CREATE_DATE":0}).toArray(function(err,array){
console.log(array.length + " 건이 조회 되었습니다");
console.log("에러메세지" + err);
var data = {"count":array.length, "rows":array , "err" : err};
res.send(JSON.stringify(data));
});
});
app.listen(3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment