Skip to content

Commit

Permalink
esqueleto de dbHandler #93
Browse files Browse the repository at this point in the history
  • Loading branch information
demiurgosoft committed Feb 23, 2016
1 parent 5723362 commit 924bccf
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 77 deletions.
50 changes: 50 additions & 0 deletions app/dbhandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
UGR Transparente. Sitio Web de la Universidad de Granada de acceso a Datos Abiertos.
Copyright (C) 2016 Andrés Ortiz Corrales
This file is part of UGR Transparente.
UGR Transparente is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UGR Transparente is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


//DbHandler para MongoDB
var mongo=require('mongodb').MongoClient;
var config=require('../config/database');

var db=null;

module.exports={
connect: function(done){
mongo.connect(config.url+config.dbName,function(err,res){
if(!err) db=res;
done(err,res);
});
},
close: function(){
if(db!==null){
db.close();
db=null;
}
},
insertDocument: function(done){



}




};
27 changes: 27 additions & 0 deletions config/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
UGR Transparente. Sitio Web de la Universidad de Granada de acceso a Datos Abiertos.
Copyright (C) 2016 Andrés Ortiz Corrales
This file is part of UGR Transparente.
UGR Transparente is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UGR Transparente is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

module.exports={
url:'mongodb://localhost:27017/',
dbName: 'transparente'



}
155 changes: 78 additions & 77 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,79 @@
{
"name": "ugr-transparente-servidor",
"version": "0.2.0",
"author": "Oficina de Software Libre de la Universidad de Granada <osl@ugr.es> (http://osl.ugr.es/)",
"contributors": [
"Juan Julián Merelo Guervós <jjmerelo@gmail.com> (https://twitter.com/jjmerelo)",
"Germán Martínez Maldonado <germaaan@gmail.com> (https://twitter.com/germaaan_)",
"Andrés Ortiz Corrales <andresortizcorrales@gmail.com> (https://twitter.com/andrewortiz21)",
"Mario Heredia Moreno <mariohm1989@gmail.com> (https://twitter.com/mhmario89)",
"Jaime Torres Benavente <jtbenavente@gmail.com> (https://twitter.com/jtbenavente)",
"Óscar Zafra Megías <oskyar@gmail.com> (https://twitter.com/OscarRZM)"
],
"description": "Portal de transparencia de la Universidad de Granada",
"keywords": [
"opendata",
"transparencia",
"ugr"
],
"bugs": {
"url": "https://github.com/oslugr/ugr-transparente-servidor/issues"
},
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "https://github.com/oslugr/ugr-transparente-servidor.git"
},
"homepage": "http://transparente.ugr.es/",
"main": "app.js",
"os": [
"linux"
],
"private": true,
"directories": {
"lib": "lib",
"test": "test"
},
"dependencies": {
"body-parser": "^1.15.0",
"cookie-parser": "^1.4.0",
"debug": "^2.2.0",
"express": "^4.13.3",
"morgan": "^1.6.1",
"serve-favicon": "^2.3.0"
},
"devDependencies": {
"async": "^1.5.2",
"bower": "^1.7.7",
"chai": "^3.5.0",
"coveralls": "^2.11.4",
"istanbul": "^0.4.0",
"jade": "^1.11.0",
"js-beautify": "^1.6.2",
"mocha": "^2.4.5",
"npm-check": "^4.1.4",
"pm2": "^1.0.1",
"supertest": "^1.2.0",
"underscore": "^1.8.3"
},
"engines": {
"node": ">=4.2.6",
"npm": ">=2.14.12"
},
"scripts": {
"start": "ENV=prod pm2 start app.js && pm2 save",
"stop": "pm2 stop app",
"restart": "ENV=prod pm2 restart app.js && pm2 save",
"test": "istanbul cover _mocha",
"dev": "ENV=dev node app.js",
"rdev": "ENV=dev pm2 restart app.js",
"deploy": "fly transparente",
"postinstall": "bower install",
"pretest": "bower install",
"check": "npm-check",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"save": "pm2 save",
"beautify": "js-beautify --indent-with-tabs --brace-style collapse -r *.js app/*.js app/routes/*.js config/*.js config/*.json test/*.js lib/*.js public/script/*.js package.json"
}
}
"name": "ugr-transparente-servidor",
"version": "0.2.0",
"author": "Oficina de Software Libre de la Universidad de Granada <osl@ugr.es> (http://osl.ugr.es/)",
"contributors": [
"Juan Julián Merelo Guervós <jjmerelo@gmail.com> (https://twitter.com/jjmerelo)",
"Germán Martínez Maldonado <germaaan@gmail.com> (https://twitter.com/germaaan_)",
"Andrés Ortiz Corrales <andresortizcorrales@gmail.com> (https://twitter.com/andrewortiz21)",
"Mario Heredia Moreno <mariohm1989@gmail.com> (https://twitter.com/mhmario89)",
"Jaime Torres Benavente <jtbenavente@gmail.com> (https://twitter.com/jtbenavente)",
"Óscar Zafra Megías <oskyar@gmail.com> (https://twitter.com/OscarRZM)"
],
"description": "Portal de transparencia de la Universidad de Granada",
"keywords": [
"opendata",
"transparencia",
"ugr"
],
"bugs": {
"url": "https://github.com/oslugr/ugr-transparente-servidor/issues"
},
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "https://github.com/oslugr/ugr-transparente-servidor.git"
},
"homepage": "http://transparente.ugr.es/",
"main": "app.js",
"os": [
"linux"
],
"private": true,
"directories": {
"lib": "lib",
"test": "test"
},
"dependencies": {
"body-parser": "^1.15.0",
"cookie-parser": "^1.4.0",
"debug": "^2.2.0",
"express": "^4.13.3",
"mongodb": "^2.1.7",
"morgan": "^1.6.1",
"serve-favicon": "^2.3.0"
},
"devDependencies": {
"async": "^1.5.2",
"bower": "^1.7.7",
"chai": "^3.5.0",
"coveralls": "^2.11.4",
"istanbul": "^0.4.0",
"jade": "^1.11.0",
"js-beautify": "^1.6.2",
"mocha": "^2.4.5",
"npm-check": "^4.1.4",
"pm2": "^1.0.1",
"supertest": "^1.2.0",
"underscore": "^1.8.3"
},
"engines": {
"node": ">=4.2.6",
"npm": ">=2.14.12"
},
"scripts": {
"start": "ENV=prod pm2 start app.js && pm2 save",
"stop": "pm2 stop app",
"restart": "ENV=prod pm2 restart app.js && pm2 save",
"test": "istanbul cover _mocha",
"dev": "ENV=dev node app.js",
"rdev": "ENV=dev pm2 restart app.js",
"deploy": "fly transparente",
"postinstall": "bower install",
"pretest": "bower install",
"check": "npm-check",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"save": "pm2 save",
"beautify": "js-beautify --indent-with-tabs --brace-style collapse -r *.js app/*.js app/routes/*.js config/*.js config/*.json test/*.js lib/*.js public/script/*.js package.json"
}
}

0 comments on commit 924bccf

Please sign in to comment.