Giter Site home page Giter Site logo

mongeo's Introduction

MonGeo

This is a script that generates a mongoDB the location of the IP.

System

Installation is in the system, so

[sudo] npm install -g mongeo

These options will give you the help

$ mongeo --help

	Usage: mongeo [options]
	
	Options:
	
		-h, --help                 output usage information
		-V, --version              output the version number
		-d, --db [db]              Name of db
		-h, --host [host]          IP for the mongoDB
		-p, --port [port]          Port for the mongoDB
		-u, --user [user]          Username for database
		-w, --pass [pass]          Password for database
		-m, --multi [multi]        Multiply servers mongo

Place all data from their databases

--db MyDB --host 127.0.0.0 --user MyUser --password MyPassword

Remember that there are certain parameters default

--host localhost --port 27017

When using - multi should be aware that you must enter either the url of connection to servers so mongo.

--multi mongodb://user:pass@localhost:port/database,mongodb://anotherhost:port,mongodb://yetanother:port

Use in the server

Run for install in the app

npm install mongeo

Configure

//Configure
var mongeo = new require('mongeo')({
		db : 'MyDB',
		host : '127.0.0.1', //If 'localhost' not place anything
		port : 27017, // If different settings
		user : 'username', //If there
		pass : 'password', //If there
});

//	OR in array
var mongeo = new require('mongeo')([ 
	'mongodb://user:pass@localhost:port/database', //Conections Database 
	'mongodb://anotherhost:port',  
	'mongodb://yetanother:port' ]); 

//	OR in  a String
var mongeo = new require('mongeo')( 'mongodb://user:pass@localhost:port/database' );

//	OR in nothing
var mongeo = new require('mongeo')( );

If you use anything that reminds serara database test and a local conectactara localhost. With default settings mongoDB.

Express

var express = require('express');
var app = express();

app.configure(function(){
	app.set('port', process.env.PORT || 3000);
	// Your configuration
	app.use(mongeo.express); // Here! 
	app.use(app.router);
	// Your configuration
});

Connect

var connect = require('connect');

var app = connect()
	.use(mongeo.connect) //Here!!!
	.use(function(req, res){
		res.end('Hello from MonGeo!\n' );
	});

Socket.IO

io.configure(function (){
	io.set('authorization', mongo.socketio);
});

mongeo's People

Stargazers

Kevin Hatfield avatar

Watchers

James Cloos avatar Jamlfy avatar

Forkers

cloudxtreme

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.