+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/yedir.iml b/.idea/yedir.iml
new file mode 100644
index 0000000..88da23d
--- /dev/null
+++ b/.idea/yedir.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 3eb83ff..b324995 100644
--- a/README.md
+++ b/README.md
@@ -1,41 +1,3 @@
-# hello-mongoose: Using Mongoose.js for elegant MongoDB object modeling in Node.js.
+http://localhost:5001/ portundan client angular
-MongoDB and Node.js are often used together because of their shared use of Javascript and its Object Notation (JSON). Mongoose is a popular helper library that provides a more rigorous modeling environment for your data, enforcing a little bit more structure as needed, while still maintaining flexibility that makes MongoDB powerful. In this article, you make a connection to a hosted MongoDB instance at add-on provider [MongoLab](http://mongolab.com) with Mongoose and model a simple object.
-
-## Deployment
-
-To deploy [the app](http://hello-mongoose.herokuapp.com/) to Heroku you can use the Heroku button [](https://heroku.com/deploy) or follow these steps:
-
-1. `git clone git://github.com/mongolab/hello-mongoose.git && cd hello-mongoose`
-2. `heroku create`
-3. `heroku addons:add mongolab`
-3. `git push heroku master`
-4. `heroku open`
-
-## Docker
-
-The app can be debugged and tested using the [Heroku Docker CLI plugin](https://devcenter.heroku.com/articles/introduction-local-development-with-docker).
-
-Make sure the plugin is installed:
-
- heroku plugins:install heroku-docker
-
-Configure Docker and Docker Compose:
-
- heroku docker:init
-
-And run the app locally:
-
- docker-compose up
-
-The app will now be available on the Docker daemon IP on port 8080.
-
-You can also use Docker to release to Heroku:
-
- heroku create
- heroku docker:release
- heroku open
-
-## License
-
-MIT Licensed
+5000 server portu node.js
diff --git a/app.js b/app.js
index 4aa20e9..8011ffb 100644
--- a/app.js
+++ b/app.js
@@ -1,167 +1,184 @@
-//
-// hello-mongoose: MongoDB with Mongoose on Node.js example on Heroku.
-// Mongoose is a object/data mapping utility for the MongoDB database.
-//
-
-// by Ben Wen with thanks to Aaron Heckmann
-
-//
-// Copyright 2015 ObjectLabs Corp.
-// ObjectLabs operates MongoLab.com a MongoDb-as-a-Service offering
-//
-// MIT Licensed
-//
-
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation files
-// (the "Software"), to deal in the Software without restriction,
-// including without limitation the rights to use, copy, modify, merge,
-// publish, distribute, sublicense, and/or sell copies of the Software,
-// and to permit persons to whom the Software is furnished to do so,
-// subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-//
-// Preamble
-var http = require ('http'); // For serving a basic web page.
-var mongoose = require ("mongoose"); // The reason for this demo.
-
-// Here we find an appropriate database to connect to, defaulting to
-// localhost if we don't find one.
-var uristring =
- process.env.MONGOLAB_URI ||
- process.env.MONGOHQ_URL ||
- 'mongodb://localhost/HelloMongoose';
-
-// The http server will listen to an appropriate port, or default to
-// port 5000.
+var http = require ('http');
+var mongoose = require ("mongoose");
+var express = require ("express");
+
+
+var bodyParser = require('body-parser');
+var app = express();
+
+app.use(express.static('public'));
+
+app.use(bodyParser.json());
+app.use(bodyParser.urlencoded({
+ extended: true
+}));
+
+app.use('/veli', function(req, res, next) {
+ res.header("Access-Control-Allow-Origin", "*");
+ res.header("Access-Control-Allow-Headers", "X-Requested-With");
+ res.send("ok veli");
+ next();
+});
+
+app.post('/ali', function(req, res){
+ res.send("ok ali");
+});
+
+app.get('/umit', function(request, response) {
+ console.log(response.user.latitude);
+});
+
+
+app.listen(5001);
+
+
+
+
+var uristring =
+ process.env.MONGOLAB_URI ||
+ process.env.MONGOHQ_URL ||
+ 'mongodb://heroku_z802lth6:8uoqc89ntqifsm7undqksf2cfq@ds055935.mongolab.com:55935/heroku_z802lth6';
+
var theport = process.env.PORT || 5000;
-// Makes connection asynchronously. Mongoose will queue up database
-// operations and release them when the connection is complete.
+
+
mongoose.connect(uristring, function (err, res) {
- if (err) {
- console.log ('ERROR connecting to: ' + uristring + '. ' + err);
- } else {
- console.log ('Succeeded connected to: ' + uristring);
- }
+ if (err) {
+ console.log ('ERROR connecting to: ' + uristring + '. ' + err);
+ } else {
+ console.log ('Succeeded connected to: ' + uristring);
+ }
});
-// This is the schema. Note the types, validation and trim
-// statements. They enforce useful constraints on the data.
+
+
var userSchema = new mongoose.Schema({
- name: {
- first: String,
- last: { type: String, trim: true }
- },
- age: { type: Number, min: 0}
+ tel: { type: Number, min: 0},
+ koordinat:{
+ Latitude:{type: Number, min: 0},
+ Longitude:{type: Number, min: 0}
+ }
+});
+
+//geo
+var GeoSchema = new mongoose.Schema({
+ location: {
+ 'type': {type: String, enum: "Point", default: "Point"}, coordinates: { type: [Number],default: [1,2]}
+ }
});
-// Compiles the schema into a model, opening (or creating, if
-// nonexistent) the 'PowerUsers' collection in the MongoDB database
-var PUser = mongoose.model('PowerUsers', userSchema);
+
+
+var PUser = mongoose.model('PowerUsers', userSchema);
+GeoJSON = mongoose.model('GeoJSON', GeoSchema);
+
// Clear out old data
PUser.remove({}, function(err) {
- if (err) {
- console.log ('error deleting old data.');
- }
+ if (err) {
+ console.log ('error deleting old data.');
+ }
});
-// Creating one user.
-var johndoe = new PUser ({
- name: { first: 'John', last: 'Doe' },
- age: 25
+//GeoJSON.remove({}, function(err) {if (err) {console.log ('error deleting old data.');}});
+
+//insert
+var bursa = new PUser ({
+
+ tel: 16,
+ koordinat: {
+ Latitude: 40.266864,
+ Longitude: 29.063448
+ }
});
+var GeoBursa = new GeoJSON ({
+ location:{ coordinates: { type: [ -73.97, 40.77 ]}}
+
+});
+
+
+// Saving it to the database.
+bursa.save(function (err) {if (err) console.log ('Error on save!')});
+//GeoBursa.save(function (err) {if (err) console.log ('Error on save!')});
-// Saving it to the database.
-johndoe.save(function (err) {if (err) console.log ('Error on save!')});
// Creating more users manually
-var janedoe = new PUser ({
- name: { first: 'Jane', last: 'Doe' },
- age: 65
+var giresun = new PUser ({
+ // name: { first: 'Giresun', last: 'Dan' },
+ tel: 28,
+ koordinat: {
+ Latitude: 40.912811,
+ Longitude: 38.389530
+ }
});
-janedoe.save(function (err) {if (err) console.log ('Error on save!')});
+giresun.save(function (err) {if (err) console.log ('Error on save!')});
// Creating more users manually
-var alicesmith = new PUser ({
- name: { first: 'Alice', last: 'Smith' },
- age: 45
+var istanbul = new PUser ({
+ // name: { first: 'Istanbul', last: 'Dan' },
+ tel: 34,
+ koordinat: {
+ Latitude: 41.00527,
+ Longitude: 28.97696
+ }
});
-alicesmith.save(function (err) {if (err) console.log ('Error on save!')});
+istanbul.save(function (err) {if (err) console.log ('Error on save!')});
// In case the browser connects before the database is connected, the
// user will see this message.
var found = ['DB Connection not yet established. Try again later. Check the console output for error messages if this persists.'];
-// Create a rudimentary http server. (Note, a real web application
-// would use a complete web framework and router like express.js).
-// This is effectively the main interaction loop for the application.
-// As new http requests arrive, the callback function gets invoked.
+
+
+
http.createServer(function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/html'});
- createWebpage(req, res);
+ res.writeHead(200, {'Content-Type': 'text/html'});
+ createWebpage(req, res);
+
}).listen(theport);
+
function createWebpage (req, res) {
- // Let's find all the documents
- PUser.find({}).exec(function(err, result) {
- if (!err) {
- res.write(html1 + JSON.stringify(result, undefined, 2) + html2 + result.length + html3);
- // Let's see if there are any senior citizens (older than 64) with the last name Doe using the query constructor
- var query = PUser.find({'name.last': 'Doe'}); // (ok in this example, it's all entries)
- query.where('age').gt(64);
- query.exec(function(err, result) {
- if (!err) {
- res.end(html4 + JSON.stringify(result, undefined, 2) + html5 + result.length + html6);
- } else {
- res.end('Error in second query. ' + err)
- }
- });
- } else {
- res.end('Error in first query. ' + err)
- };
- });
+ // Let's find all the documents
+ PUser.find({}).exec(function(err, result) {
+ if (!err) {
+ res.write(html1 + JSON.stringify(result, undefined, 3) + html2 + result.length + html3);
+
+ var query = PUser.find({'name.last': 'Dan'});
+ query.where('tel').lt(93);
+
+ query.exec(function(err, result) {
+ if (!err) {
+ res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6 + html7);
+ } else {
+ res.end('Error in second query. ' + err)
+ }
+ });
+ } else {
+ res.end('Error in first query. ' + err)
+ }
+ });
}
// Tell the console we're getting ready.
// The listener in http.createServer should still be active after these messages are emitted.
console.log('http server will be listening on port %d', theport);
-console.log('CTRL+C to exit');
-//
-// House keeping.
-//
// The rudimentary HTML content in three pieces.
-var html1 = '
+
+
\ No newline at end of file
diff --git a/public/express.js b/public/express.js
new file mode 100644
index 0000000..11190f5
--- /dev/null
+++ b/public/express.js
@@ -0,0 +1,26 @@
+/**
+ * Created by özge on 11/14/2015.
+ */
+
+var express = require ("express");
+var app = express();
+var path = require("path");
+console.log(__dirname)
+app.get('/',function(req,res){
+ res.sendFile(path.join(__dirname+'/index.html'));
+ //__dirname : It will resolve to your project folder.
+});
+
+app.get('/login',function(req,res){
+ res.sendFile(path.join(__dirname+'/login.html'));
+});
+
+app.get('/mainpage',function(req,res){
+ res.sendFile(path.join(__dirname+'/MainPage.html'));
+});
+
+app.get('/basket',function(req,res){
+ res.sendFile(path.join(__dirname+'/basket.html'));
+});
+
+app.listen(63342);
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..b9d5a08
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,131 @@
+
+
+ Yedir
+
+
+
+
+
+
+
+
+
+
+
+
Yedir'e Hosgeldiniz.
+
Yedir kar amacı güdmeyen bir kuruluştur. İsterseniz İhtiyac sahipleri için yemek bağışında bulunabilir isterseniz de ihtiyacınız olduğunda yemeğin size gelmesi sağlayabilirsiniz. Bagış da yapsanız ihtiyaç sahibi de olsanız Yedir iznizi sürmez kimlik bilgilerinizle ilgilenmez.
+
+
\ No newline at end of file
diff --git a/public/message.js b/public/message.js
new file mode 100644
index 0000000..1db93dd
--- /dev/null
+++ b/public/message.js
@@ -0,0 +1,20 @@
+/**
+ * Created by özge on 2/21/2016.
+ */
+angular.module('message', []).factory('$message', ['$http',
+ function($http) {
+ return {
+ create: function(params) {
+ var method = 'POST';
+ var url = "http://serene-woodland-88772.herokuapp.com/";
+ console.log($.param(params));
+ return $http({
+ method: method,
+ url : url,
+ data: $.param(params),
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ });
+ }
+ };
+ }
+]);
\ No newline at end of file
diff --git a/public/page.html b/public/page.html
new file mode 100644
index 0000000..b56669f
--- /dev/null
+++ b/public/page.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
Page
+
+
\ No newline at end of file
diff --git a/yedir.png b/yedir.png
new file mode 100644
index 0000000..169eeef
Binary files /dev/null and b/yedir.png differ