This file contains hidden or 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
//Grunt configuration | |
module.exports = function(grunt) { | |
'use strict'; | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
//blanket_mocha CONFIGURATION | |
blanket_mocha: { | |
options: { | |
run: true, | |
reporter: 'Min', |
This file contains hidden or 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
//KARMA CONFIGURATION | |
grunt.initConfig({ | |
//PREVIOUS CODE.. | |
karma : { | |
options: { | |
//Karma config file | |
configFile: 'karma.conf.js', | |
files: [ |
This file contains hidden or 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
//KARMA CONFIGURATIONS | |
module.exports = function(config) { | |
config.set({ | |
// base path | |
basePath: '', | |
// frameworks to use | |
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
frameworks: ['mocha'], | |
// PORT NUMBER | |
port: 9877, |
This file contains hidden or 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
<packages> | |
<package id="mongocsharpdriver" version="2.0.1" /> | |
<package id="MongoDB.Driver" version="2.0.1" /> | |
<package id="MongoDB.Driver.Core" version="2.0.1" /> | |
<package id="MongoDB.Bson" version="2.0.1" /> | |
</packages> |
This file contains hidden or 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
using MongoDB.Bson; | |
using System.ComponentModel.DataAnnotations; | |
using MongoDB.Bson.Serialization.Attributes; | |
namespace Blog.QueryingMongoDb.Models | |
{ | |
public class ContactModel | |
{ | |
[BsonId] | |
public ObjectId Id { get; set; } //MongoDb uses this field as identity. |
This file contains hidden or 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
using MongoDB.Driver; | |
namespace Blog.QueryingMongoDb.Models.Repository | |
{ | |
public class MongoDbRepo | |
{ | |
//The client that manage the connection | |
public MongoClient Client; | |
//The interface that manage the database |
This file contains hidden or 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
using MongoDB.Bson; | |
using MongoDB.Driver; | |
using System.Collections.Generic; | |
namespace Blog.QueryingMongoDb.Models.Repository | |
{ | |
public class ContactCollection | |
{ | |
//Intializes the mongo db repository | |
internal MongoDbRepo _repo = new MongoDbRepo("mongodb://127.0.0.1:27017", "QueryMongoDb"); |
This file contains hidden or 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
using System; | |
using System.Web.Mvc; | |
using Blog.QueryingMongoDb.Models; | |
using Blog.QueryingMongoDb.Models.Repository; | |
namespace Blog.QueryingMongoDb.Controllers | |
{ | |
public class ContactController : Controller | |
{ | |
//Private instance of contact collection |
This file contains hidden or 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
<html> | |
<head> | |
<title>JSON - JSONP tests</title> | |
<!--Include jquery--> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
//DEF response | |
var data = {}; | |
data.title = "title"; |
This file contains hidden or 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
//DEPENDENCIES | |
var express = require('express'); | |
//Initialize Express.js | |
var app = express(); | |
//JSON Get Request | |
app.get('/endpointJSON', function(req, res){ | |
//LOG |