This file contains 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
// Demonstrate how to register services | |
// In this case it is a simple value service. | |
angular.module('myBeerApp.services', ['ngResource']). | |
value('version', '0.1'). | |
factory('beerDB', function($resource) { | |
return $resource('URL',{ | |
alt:'json', | |
appToken:'TOKEN', | |
q:'rock', | |
callback: 'JSON_CALLBACK' |
This file contains 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
var insertData = function(req, res){ | |
var coord = req.body['geo'].split(','); | |
var myPlace = new Place({geo:coord}); | |
var callback = function(err,resultset) { | |
if (!err) { | |
res.json(resultset); | |
} else { | |
throw err; | |
}}; | |
myPlace.save(callback); |
This file contains 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
// Module dependencies | |
var mongoose = require ('mongoose'); | |
mongoose.connect('localhost','datatest'); | |
// Schema definition | |
var placeSchema = mongoose.Schema({ | |
name: String, | |
geo: {type: [Number], index: '2d'} |