Skip to content

Instantly share code, notes, and snippets.

@jamlfy
Last active December 30, 2015 22:49
Show Gist options
  • Save jamlfy/7897132 to your computer and use it in GitHub Desktop.
Save jamlfy/7897132 to your computer and use it in GitHub Desktop.
Exportación
var connect = function ( config ){
this.db = mongo.createConnection( config.url );
};
// Mis metodos..
// y mas funciones necesarias
exports.Connect = connect;
// Iniciando proceso
GLOBAL.connection = require('./file_1.js');
GLOBAL.db = new connection.Connect( 'mongo://localhost:2781/MiDB' );
var routes = require('./file_method.js');
var express = require('express');
var app = express();
// Metodo de uso
// db.collection...
app.post('/upload', routes.upload);
exports.upload = funciton(res, req){
db.collection(..);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment