From 9b126314b348f3e7ef43a1e132b060bb9285b092 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 03:43:32 +0200 Subject: [PATCH 01/72] 2 --- .idea/.name | 1 + .idea/encodings.xml | 6 ++ .idea/misc.xml | 13 ++++ .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 ++ .idea/workspace.xml | 176 ++++++++++++++++++++++++++++++++++++++++++++ .idea/yedir.iml | 8 ++ app.js | 2 +- 8 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 .idea/.name create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 .idea/yedir.iml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..c0b5402 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +yedir \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..72abef0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4606feb --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..d502356 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1455932534720 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/yedir.iml b/.idea/yedir.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/yedir.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app.js b/app.js index 4aa20e9..4affdf9 100644 --- a/app.js +++ b/app.js @@ -162,6 +162,6 @@ var html3 = ' documents. '; var html4 = '

Queried (name.last = "Doe", age >64) Documents in MonogoDB database

 ';
 var html5 = '
'; var html6 = ' documents. \ -
Demo code available at github.com
'; + '; From ccdedfca9e909c92d02f1d149ec4c5c26ba13d2b Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 03:45:17 +0200 Subject: [PATCH 02/72] 3 --- .idea/workspace.xml | 27 +++++++------- app.js | 90 +++++++++++++++------------------------------ 2 files changed, 42 insertions(+), 75 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d502356..4314ba4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,6 @@ - @@ -27,12 +26,12 @@ - - + + - - - + + + @@ -56,8 +55,8 @@ true - @@ -131,7 +130,7 @@ - + @@ -162,12 +161,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index 4affdf9..f9c5af7 100644 --- a/app.js +++ b/app.js @@ -1,48 +1,13 @@ -// -// 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 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'; +// 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. @@ -51,7 +16,7 @@ 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) { + if (err) { console.log ('ERROR connecting to: ' + uristring + '. ' + err); } else { console.log ('Succeeded connected to: ' + uristring); @@ -65,7 +30,9 @@ var userSchema = new mongoose.Schema({ first: String, last: { type: String, trim: true } }, - age: { type: Number, min: 0} + age: { type: Number, min: 0}, + Latitude:{type: Number}, + Longitude:{type: Number} }); // Compiles the schema into a model, opening (or creating, if @@ -80,13 +47,15 @@ PUser.remove({}, function(err) { }); // Creating one user. -var johndoe = new PUser ({ - name: { first: 'John', last: 'Doe' }, - age: 25 +var bursa = new PUser ({ + name: { first: 'Bursa', last: 'Dan' }, + age: 16, + Latitude:40,266864, + Longitude:29,063448 }); -// Saving it to the database. -johndoe.save(function (err) {if (err) console.log ('Error on save!')}); +// Saving it to the database. +bursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var janedoe = new PUser ({ @@ -108,8 +77,8 @@ alicesmith.save(function (err) {if (err) console.log ('Error on save!')}); 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. +// 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'}); @@ -118,18 +87,18 @@ http.createServer(function (req, res) { function createWebpage (req, res) { // Let's find all the documents - PUser.find({}).exec(function(err, result) { - if (!err) { + 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) - } + 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) @@ -152,8 +121,8 @@ var html1 = ' hello-mongoose: MongoLab MongoDB Mongoose Node.js Demo on H <style> body {color: #394a5f; font-family: sans-serif} </style> \ </head> \ <body> \ -<h1> hello-mongoose: MongoLab MongoDB Mongoose Node.js Demo on Heroku </h1> \ -See the <a href="https://devcenter.heroku.com/articles/nodejs-mongoose">supporting article on the Dev Center</a> to learn more about data modeling with Mongoose. \ +<h1>Yedir</h1> \ +See the <a href="http://serene-woodland-88772.herokuapp.com/"> asd \ <br\> \ <br\> \ <br\> <h2> All Documents in MonogoDB database </h2> <pre><code> '; @@ -162,6 +131,5 @@ var html3 = ' documents. </i> <br\> <br\>'; var html4 = '<h2> Queried (name.last = "Doe", age >64) Documents in MonogoDB database </h2> <pre><code> '; var html5 = '</code></pre> <br\> <i>'; var html6 = ' documents. </i> <br\> <br\> \ -<br\> <br\>'; - +<br\> <br\> '; From 2c03a0dc87cec2a19ee7534bef55cb42be4b1f6f Mon Sep 17 00:00:00 2001 From: Umit Arslan <umit.arslan@outlook.com> Date: Sat, 20 Feb 2016 03:48:25 +0200 Subject: [PATCH 03/72] 4 --- .idea/workspace.xml | 20 ++++++++++---------- app.js | 8 ++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4314ba4..540db91 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ <file leaf-file-name="app.js" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.9483649"> - <caret line="135" column="0" selection-start-line="135" selection-start-column="0" selection-end-line="135" selection-end-column="0" /> + <state vertical-scroll-proportion="0.6053131"> + <caret line="73" column="21" selection-start-line="73" selection-start-column="21" selection-end-line="73" selection-end-column="21" /> <folding> - <marker date="1455932703000" expanded="true" signature="3941:4017" placeholder="..." /> - <marker date="1455932703000" expanded="true" signature="4026:4118" placeholder="..." /> - <marker date="1455932703000" expanded="true" signature="4108:4118" placeholder="..." /> + <marker date="1455932897000" expanded="true" signature="4031:4107" placeholder="..." /> + <marker date="1455932897000" expanded="true" signature="4116:4208" placeholder="..." /> + <marker date="1455932897000" expanded="true" signature="4198:4208" placeholder="..." /> </folding> </state> </provider> @@ -161,12 +161,12 @@ <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.9483649"> - <caret line="135" column="0" selection-start-line="135" selection-start-column="0" selection-end-line="135" selection-end-column="0" /> + <state vertical-scroll-proportion="0.6053131"> + <caret line="73" column="21" selection-start-line="73" selection-start-column="21" selection-end-line="73" selection-end-column="21" /> <folding> - <marker date="1455932703000" expanded="true" signature="3941:4017" placeholder="..." /> - <marker date="1455932703000" expanded="true" signature="4026:4118" placeholder="..." /> - <marker date="1455932703000" expanded="true" signature="4108:4118" placeholder="..." /> + <marker date="1455932897000" expanded="true" signature="4031:4107" placeholder="..." /> + <marker date="1455932897000" expanded="true" signature="4116:4208" placeholder="..." /> + <marker date="1455932897000" expanded="true" signature="4198:4208" placeholder="..." /> </folding> </state> </provider> diff --git a/app.js b/app.js index f9c5af7..ad633b6 100644 --- a/app.js +++ b/app.js @@ -60,14 +60,18 @@ bursa.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 + age: 65, + Latitude:40,266864, + Longitude:29,063448 }); janedoe.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 + age: 45, + Latitude:40,266864, + Longitude:29,063448 }); alicesmith.save(function (err) {if (err) console.log ('Error on save!')}); From 92eb319c37c4ff812ef500c5cef3354fd80d4f0a Mon Sep 17 00:00:00 2001 From: Umit Arslan <umit.arslan@outlook.com> Date: Sat, 20 Feb 2016 03:50:32 +0200 Subject: [PATCH 04/72] 5 --- .idea/workspace.xml | 67 ++++++++++++++++++++++++++++++++++++--------- app.js | 16 +++++------ 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 540db91..768652c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ <file leaf-file-name="app.js" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.6053131"> - <caret line="73" column="21" selection-start-line="73" selection-start-column="21" selection-end-line="73" selection-end-column="21" /> + <state vertical-scroll-proportion="1.6793169"> + <caret line="73" column="14" selection-start-line="73" selection-start-column="14" selection-end-line="73" selection-end-column="14" /> <folding> - <marker date="1455932897000" expanded="true" signature="4031:4107" placeholder="..." /> - <marker date="1455932897000" expanded="true" signature="4116:4208" placeholder="..." /> - <marker date="1455932897000" expanded="true" signature="4198:4208" placeholder="..." /> + <marker date="1455933009000" expanded="true" signature="4005:4081" placeholder="..." /> + <marker date="1455933009000" expanded="true" signature="4090:4182" placeholder="..." /> + <marker date="1455933009000" expanded="true" signature="4172:4182" placeholder="..." /> </folding> </state> </provider> @@ -55,8 +55,8 @@ <detection-done>true</detection-done> </component> <component name="ProjectFrameBounds"> - <option name="x" value="210" /> - <option name="y" value="32" /> + <option name="x" value="170" /> + <option name="y" value="27" /> <option name="width" value="1246" /> <option name="height" value="725" /> </component> @@ -113,11 +113,52 @@ <property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="WebServerToolWindowFactoryState" value="false" /> <property name="HbShouldOpenHtmlAsHb" value="" /> + <property name="js-jscs-nodeInterpreter" value="/usr/local/bin/node" /> </component> <component name="RunManager"> + <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application"> + <method /> + </configuration> + <configuration default="true" type="DartTestRunConfigurationType" factoryName="Dart Test"> + <method /> + </configuration> + <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma" config-file=""> + <envs /> + <method /> + </configuration> + <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug"> + <method /> + </configuration> <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" working-dir=""> <method /> </configuration> + <configuration default="true" type="cucumber.js" factoryName="Cucumber.js"> + <option name="cucumberJsArguments" value="" /> + <option name="executablePath" /> + <option name="filePath" /> + <method /> + </configuration> + <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js"> + <method /> + </configuration> + <configuration default="true" type="js.build_tools.npm" factoryName="npm"> + <command value="run-script" /> + <scripts /> + <envs /> + <method /> + </configuration> + <configuration default="true" type="mocha-javascript-test-runner" factoryName="Mocha"> + <node-options /> + <working-directory>$PROJECT_DIR$</working-directory> + <pass-parent-env>true</pass-parent-env> + <envs /> + <ui>bdd</ui> + <extra-mocha-options /> + <test-kind>DIRECTORY</test-kind> + <test-directory /> + <recursive>false</recursive> + <method /> + </configuration> </component> <component name="ShelveChangesManager" show_recycled="false" /> <component name="TaskManager"> @@ -130,7 +171,7 @@ <servers /> </component> <component name="ToolWindowManager"> - <frame x="210" y="32" width="1246" height="725" extended-state="0" /> + <frame x="170" y="27" width="1246" height="725" extended-state="0" /> <editor active="true" /> <layout> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24979591" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> @@ -161,12 +202,12 @@ <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.6053131"> - <caret line="73" column="21" selection-start-line="73" selection-start-column="21" selection-end-line="73" selection-end-column="21" /> + <state vertical-scroll-proportion="1.6793169"> + <caret line="73" column="14" selection-start-line="73" selection-start-column="14" selection-end-line="73" selection-end-column="14" /> <folding> - <marker date="1455932897000" expanded="true" signature="4031:4107" placeholder="..." /> - <marker date="1455932897000" expanded="true" signature="4116:4208" placeholder="..." /> - <marker date="1455932897000" expanded="true" signature="4198:4208" placeholder="..." /> + <marker date="1455933009000" expanded="true" signature="4005:4081" placeholder="..." /> + <marker date="1455933009000" expanded="true" signature="4090:4182" placeholder="..." /> + <marker date="1455933009000" expanded="true" signature="4172:4182" placeholder="..." /> </folding> </state> </provider> diff --git a/app.js b/app.js index ad633b6..ccaccba 100644 --- a/app.js +++ b/app.js @@ -31,8 +31,8 @@ var userSchema = new mongoose.Schema({ last: { type: String, trim: true } }, age: { type: Number, min: 0}, - Latitude:{type: Number}, - Longitude:{type: Number} + Latitude:{type: Number, min: 0}, + Longitude:{type: Number, min: 0} }); // Compiles the schema into a model, opening (or creating, if @@ -50,8 +50,8 @@ PUser.remove({}, function(err) { var bursa = new PUser ({ name: { first: 'Bursa', last: 'Dan' }, age: 16, - Latitude:40,266864, - Longitude:29,063448 + Latitude:40, + Longitude:29 }); // Saving it to the database. @@ -61,8 +61,8 @@ bursa.save(function (err) {if (err) console.log ('Error on save!')}); var janedoe = new PUser ({ name: { first: 'Jane', last: 'Doe' }, age: 65, - Latitude:40,266864, - Longitude:29,063448 + Latitude:40, + Longitude:29 }); janedoe.save(function (err) {if (err) console.log ('Error on save!')}); @@ -70,8 +70,8 @@ janedoe.save(function (err) {if (err) console.log ('Error on save!')}); var alicesmith = new PUser ({ name: { first: 'Alice', last: 'Smith' }, age: 45, - Latitude:40,266864, - Longitude:29,063448 + Latitude:40, + Longitude:29 }); alicesmith.save(function (err) {if (err) console.log ('Error on save!')}); From 96a80e44f1a554e0b569a01df41e231937fda98a Mon Sep 17 00:00:00 2001 From: Umit Arslan <umit.arslan@outlook.com> Date: Sat, 20 Feb 2016 03:52:06 +0200 Subject: [PATCH 05/72] 5 --- .idea/workspace.xml | 20 ++++++++++---------- app.js | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 768652c..8c294d4 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ <file leaf-file-name="app.js" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="1.6793169"> - <caret line="73" column="14" selection-start-line="73" selection-start-column="14" selection-end-line="73" selection-end-column="14" /> + <state vertical-scroll-proportion="0.54079694"> + <caret line="53" column="19" selection-start-line="53" selection-start-column="19" selection-end-line="53" selection-end-column="19" /> <folding> - <marker date="1455933009000" expanded="true" signature="4005:4081" placeholder="..." /> - <marker date="1455933009000" expanded="true" signature="4090:4182" placeholder="..." /> - <marker date="1455933009000" expanded="true" signature="4172:4182" placeholder="..." /> + <marker date="1455933115000" expanded="true" signature="4015:4091" placeholder="..." /> + <marker date="1455933115000" expanded="true" signature="4100:4192" placeholder="..." /> + <marker date="1455933115000" expanded="true" signature="4182:4192" placeholder="..." /> </folding> </state> </provider> @@ -202,12 +202,12 @@ <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="1.6793169"> - <caret line="73" column="14" selection-start-line="73" selection-start-column="14" selection-end-line="73" selection-end-column="14" /> + <state vertical-scroll-proportion="0.54079694"> + <caret line="53" column="19" selection-start-line="53" selection-start-column="19" selection-end-line="53" selection-end-column="19" /> <folding> - <marker date="1455933009000" expanded="true" signature="4005:4081" placeholder="..." /> - <marker date="1455933009000" expanded="true" signature="4090:4182" placeholder="..." /> - <marker date="1455933009000" expanded="true" signature="4172:4182" placeholder="..." /> + <marker date="1455933115000" expanded="true" signature="4015:4091" placeholder="..." /> + <marker date="1455933115000" expanded="true" signature="4100:4192" placeholder="..." /> + <marker date="1455933115000" expanded="true" signature="4182:4192" placeholder="..." /> </folding> </state> </provider> diff --git a/app.js b/app.js index ccaccba..38a13cc 100644 --- a/app.js +++ b/app.js @@ -50,8 +50,8 @@ PUser.remove({}, function(err) { var bursa = new PUser ({ name: { first: 'Bursa', last: 'Dan' }, age: 16, - Latitude:40, - Longitude:29 + Latitude:40.1234, + Longitude:29.1234 }); // Saving it to the database. From dedc145a214166178b7d31beadeeb4b879d1a638 Mon Sep 17 00:00:00 2001 From: Umit Arslan <umit.arslan@outlook.com> Date: Sat, 20 Feb 2016 03:57:46 +0200 Subject: [PATCH 06/72] 7 --- .idea/jsLibraryMappings.xml | 6 ++++++ .idea/workspace.xml | 31 ++++++++++++++++++++----------- app.js | 14 +++++--------- 3 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 .idea/jsLibraryMappings.xml diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..d23208f --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="JavaScriptLibraryMappings"> + <includedPredefinedLibrary name="Node.js Core" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8c294d4..2131d4c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ChangeListManager"> - <list default="true" id="d08fda8b-3217-4bca-8228-66a54c555a61" name="Default" comment=""> + <list default="true" id="d08fda8b-3217-4bca-8228-66a54c555a61" name="Default" comment="7"> + <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/jsLibraryMappings.xml" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app.js" afterPath="$PROJECT_DIR$/app.js" /> </list> <ignored path="yedir.iws" /> @@ -26,12 +28,12 @@ <file leaf-file-name="app.js" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.54079694"> - <caret line="53" column="19" selection-start-line="53" selection-start-column="19" selection-end-line="53" selection-end-column="19" /> + <state vertical-scroll-proportion="0.33333334"> + <caret line="91" column="24" selection-start-line="91" selection-start-column="24" selection-end-line="91" selection-end-column="24" /> <folding> - <marker date="1455933115000" expanded="true" signature="4015:4091" placeholder="..." /> - <marker date="1455933115000" expanded="true" signature="4100:4192" placeholder="..." /> - <marker date="1455933115000" expanded="true" signature="4182:4192" placeholder="..." /> + <marker date="1455933439000" expanded="true" signature="3930:4006" placeholder="..." /> + <marker date="1455933439000" expanded="true" signature="4015:4091" placeholder="..." /> + <marker date="1455933439000" expanded="true" signature="4081:4091" placeholder="..." /> </folding> </state> </provider> @@ -114,6 +116,7 @@ <property name="WebServerToolWindowFactoryState" value="false" /> <property name="HbShouldOpenHtmlAsHb" value="" /> <property name="js-jscs-nodeInterpreter" value="/usr/local/bin/node" /> + <property name="javascript.nodejs.core.library.configured.version" value="5.6.0" /> </component> <component name="RunManager"> <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application"> @@ -176,6 +179,7 @@ <layout> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24979591" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> + <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32840723" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> @@ -195,6 +199,11 @@ <component name="VcsContentAnnotationSettings"> <option name="myLimit" value="2678400000" /> </component> + <component name="VcsManagerConfiguration"> + <MESSAGE value="6" /> + <MESSAGE value="7" /> + <option name="LAST_COMMIT_MESSAGE" value="7" /> + </component> <component name="XDebuggerManager"> <breakpoint-manager /> <watches-manager /> @@ -202,12 +211,12 @@ <component name="editorHistoryManager"> <entry file="file://$PROJECT_DIR$/app.js"> <provider selected="true" editor-type-id="text-editor"> - <state vertical-scroll-proportion="0.54079694"> - <caret line="53" column="19" selection-start-line="53" selection-start-column="19" selection-end-line="53" selection-end-column="19" /> + <state vertical-scroll-proportion="0.33333334"> + <caret line="91" column="24" selection-start-line="91" selection-start-column="24" selection-end-line="91" selection-end-column="24" /> <folding> - <marker date="1455933115000" expanded="true" signature="4015:4091" placeholder="..." /> - <marker date="1455933115000" expanded="true" signature="4100:4192" placeholder="..." /> - <marker date="1455933115000" expanded="true" signature="4182:4192" placeholder="..." /> + <marker date="1455933439000" expanded="true" signature="3930:4006" placeholder="..." /> + <marker date="1455933439000" expanded="true" signature="4015:4091" placeholder="..." /> + <marker date="1455933439000" expanded="true" signature="4081:4091" placeholder="..." /> </folding> </state> </provider> diff --git a/app.js b/app.js index 38a13cc..8d7f355 100644 --- a/app.js +++ b/app.js @@ -106,7 +106,7 @@ function createWebpage (req, res) { }); } else { res.end('Error in first query. ' + err) - }; + } }); } @@ -115,25 +115,21 @@ function createWebpage (req, res) { 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 = '<title> hello-mongoose: MongoLab MongoDB Mongoose Node.js Demo on Heroku \ +var html1 = ' Yedir \ \ \ \ \

Yedir

\ -See the asd \ +See the asd \ \ \

All Documents in MonogoDB database

 ';
 var html2 = '
'; var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age >64) Documents in MonogoDB database

 ';
+var html4 = '

Queried (name.last = "Doe", age >64)

 ';
 var html5 = '
'; -var html6 = ' documents. \ - '; +var html6 = ' documents. '; From 38557bc7f7b1aa4061036e9f97917581cc7f9f73 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 03:59:50 +0200 Subject: [PATCH 07/72] 8 --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 8d7f355..2eac2f5 100644 --- a/app.js +++ b/app.js @@ -131,5 +131,5 @@ var html2 = '
'; var html3 = ' documents. '; var html4 = '

Queried (name.last = "Doe", age >64)

 ';
 var html5 = '
'; -var html6 = ' documents. '; +var html6 = ' documents. '; From 391d39798444358c1cb3020809e92cb53674a86f Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:00:37 +0200 Subject: [PATCH 08/72] 8 --- .idea/workspace.xml | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2131d4c..8fec912 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,8 @@ - - + - @@ -28,12 +26,12 @@ - - + + - - - + + + @@ -171,15 +169,22 @@ - + - + @@ -202,7 +207,8 @@ - @@ -211,12 +217,12 @@ - - + + - - - + + + From 7f44e75a0dd954c7c72d627b9c6c5a8fd24e074e Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:01:40 +0200 Subject: [PATCH 09/72] 9 --- .idea/workspace.xml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8fec912..c641555 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,7 @@ - - - + @@ -184,9 +188,9 @@ - + - + @@ -217,7 +221,7 @@ - + From 2ce858b581a8e44a8ba175118307fedc5d43e1d8 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:18:25 +0200 Subject: [PATCH 10/72] 11 --- .idea/workspace.xml | 29 ++++++++++++++++------------- app.js | 4 ++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c641555..e701a17 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,10 @@ - + + + + - + - + @@ -221,12 +224,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index 2eac2f5..7a92179 100644 --- a/app.js +++ b/app.js @@ -122,8 +122,8 @@ var html1 = ' Yedir \ \ \ \ -

Yedir

\ -See the
asd \ +

Herkese Yedir

\ +See the
asd \ \ \

All Documents in MonogoDB database

 ';

From 727865e0bada65c4dc444be468a1175bd2b82538 Mon Sep 17 00:00:00 2001
From: Umit Arslan 
Date: Sat, 20 Feb 2016 04:34:18 +0200
Subject: [PATCH 11/72] 12

---
 .idea/workspace.xml | 128 +++++++++++++++++++++++++++++++++++------
 Procfile            |   2 +
 README.md           |  25 --------
 app.js              |   2 +-
 deneme/app.js       | 135 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 249 insertions(+), 43 deletions(-)
 create mode 100644 deneme/app.js

diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e701a17..ca6c388 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,7 +2,10 @@
 
   
     
+      
       
+      
+      
       
     
     
@@ -24,15 +27,29 @@
   
   
     
-      
+      
         
           
-            
-              
+            
+              
               
-                
-                
-                
+                
+                
+                
+              
+            
+          
+        
+      
+      
+        
+          
+            
+              
+              
+                
+                
+                
               
             
           
@@ -46,6 +63,9 @@
   
     
@@ -56,10 +76,10 @@
     true
   
   
-    
   
     
@@ -106,6 +126,20 @@
               
+  
+    
+      
+    
+  
   
     
       
@@ -163,6 +202,9 @@
     
   
   
+  
+    
+  
   
     
       
@@ -186,14 +228,14 @@
     
   
   
-    
+    
     
     
-      
+      
       
       
       
-      
+      
       
       
       
@@ -208,6 +250,14 @@
       
     
   
+  
+    
+    
+  
   
     
@@ -222,14 +272,58 @@
     
   
   
+    
+      
+        
+          
+          
+        
+      
+    
+    
+      
+        
+          
+          
+        
+      
+    
+    
+      
+        
+          
+          
+        
+      
+    
+    
+      
+        
+          
+          
+        
+      
+    
     
       
-        
-          
+        
+          
+          
+            
+            
+            
+          
+        
+      
+    
+    
+      
+        
+          
           
-            
-            
-            
+            
+            
+            
           
         
       
diff --git a/Procfile b/Procfile
index e1d4131..b371eef 100644
--- a/Procfile
+++ b/Procfile
@@ -1 +1,3 @@
 web: node app.js
+web: node deneme\app.js
+web: node deneme/app.js
diff --git a/README.md b/README.md
index 3eb83ff..728e2d0 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
 # hello-mongoose: Using Mongoose.js for elegant MongoDB object modeling in Node.js.  
 
-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
 
@@ -12,30 +11,6 @@ To deploy [the app](http://hello-mongoose.herokuapp.com/) to Heroku you can use
 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
diff --git a/app.js b/app.js
index 7a92179..5e69639 100644
--- a/app.js
+++ b/app.js
@@ -117,7 +117,7 @@ console.log('CTRL+C to exit');
 
 
 // The rudimentary HTML content in three pieces.
-var html1 = ' Yedir \
+var html1 = 'Herkese Yedir 1 \
  \
  \
  \
diff --git a/deneme/app.js b/deneme/app.js
new file mode 100644
index 0000000..8562909
--- /dev/null
+++ b/deneme/app.js
@@ -0,0 +1,135 @@
+
+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 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);
+  }
+});
+
+// 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},
+  Latitude:{type: Number, min: 0},
+  Longitude:{type: Number, min: 0}
+});
+
+// Compiles the schema into a model, opening (or creating, if
+// nonexistent) the 'PowerUsers' collection in the MongoDB database
+var PUser = mongoose.model('PowerUsers', userSchema);
+
+// Clear out old data
+PUser.remove({}, function(err) {
+  if (err) {
+    console.log ('error deleting old data.');
+  }
+});
+
+// Creating one user.
+var bursa = new PUser ({
+  name: { first: 'Bursa', last: 'Dan' },
+  age: 16,
+  Latitude:40.1234,
+  Longitude:29.1234
+});
+
+// Saving it to the database.
+bursa.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,
+  Latitude:40,
+  Longitude:29
+});
+janedoe.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,
+  Latitude:40,
+  Longitude:29
+});
+alicesmith.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);
+}).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)
+    }
+  });
+}
+
+// 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');
+
+
+// The rudimentary HTML content in three pieces.
+var html1 = '2 Yedir \
+ \
+ \
+ \
+ \
+

Herkese Yedir

\ +See the
asd \ + \ + \ +

All Documents in MonogoDB database

 ';
+var html2 = '
'; +var html3 = ' documents. '; +var html4 = '

Queried (name.last = "Doe", age >64)

 ';
+var html5 = '
'; +var html6 = ' documents. '; + From a5c6965d6ee2ff38b687a14484e6a4351ce9ab20 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:38:53 +0200 Subject: [PATCH 12/72] 12 --- .idea/workspace.xml | 65 ++++++++++++++++++++++++++------------------- deneme/app.js | 4 +-- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ca6c388..87c1cd3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,8 @@ - - - - + @@ -26,7 +23,7 @@ - + @@ -44,12 +41,12 @@ - - + + - - - + + + @@ -65,8 +62,8 @@ @@ -106,7 +103,6 @@ - @@ -142,6 +138,7 @@ + @@ -180,6 +177,11 @@ + + + + + @@ -233,19 +235,19 @@ - - - + + - - + + - + - + + @@ -272,11 +274,22 @@ + + + + + + + + + + + + - @@ -292,7 +305,6 @@ - @@ -300,7 +312,6 @@ - @@ -318,12 +329,12 @@ - - + + - - - + + + diff --git a/deneme/app.js b/deneme/app.js index 8562909..e6af542 100644 --- a/deneme/app.js +++ b/deneme/app.js @@ -119,10 +119,10 @@ console.log('CTRL+C to exit'); // The rudimentary HTML content in three pieces. var html1 = '2 Yedir \ \ - \ + \ \ \ -

Herkese Yedir

\ +

3Herkese Yedir

\ See the
asd \ \ \ From 9b04e2f838749ebfc8b710d0b915be705476ff64 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:42:19 +0200 Subject: [PATCH 13/72] 13 --- .idea/workspace.xml | 73 ++++++------------------ app.js | 2 +- deneme/app.js | 135 -------------------------------------------- 3 files changed, 18 insertions(+), 192 deletions(-) delete mode 100644 deneme/app.js diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 87c1cd3..cff4d66 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,9 @@ + - + @@ -24,29 +25,15 @@ - - - - - - - - - - - - - - - + - - + + - - - + + + @@ -62,8 +49,8 @@ @@ -122,20 +109,6 @@ asd \ - \ - \ -

All Documents in MonogoDB database

 ';
-var html2 = '
'; -var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age >64)

 ';
-var html5 = '
'; -var html6 = ' documents. '; - From 60fa76d6b35d6213953da7a2ea0f5256957a841a Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:43:14 +0200 Subject: [PATCH 14/72] 15 --- .idea/workspace.xml | 28 +++++++++++++--------------- app.js | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index cff4d66..d5fbe3f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,6 @@ - - @@ -28,12 +26,12 @@ - - + + - - - + + + @@ -252,9 +250,9 @@ - - - + + + @@ -290,12 +288,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index ecf9a07..f35fab7 100644 --- a/app.js +++ b/app.js @@ -122,7 +122,7 @@ var html1 = '123Herkese Yedir 1 \ \ \ \ -

Herkese Yedir

\ +

23Herkese Yedir

\ See the
asd \ \ \ From 261548bd52ac9b606c9ef70ef97957dd67b169ae Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:43:54 +0200 Subject: [PATCH 15/72] 16 --- .idea/workspace.xml | 35 +++++++++++++++++++++++------------ Procfile | 2 -- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d5fbe3f..585175b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,7 @@ - + @@ -23,10 +23,10 @@ - + - + @@ -37,6 +37,16 @@ + + + + + + + + + + @@ -46,9 +56,9 @@ @@ -279,16 +289,9 @@ - - - - - - - - + @@ -298,5 +301,13 @@ + + + + + + + + \ No newline at end of file diff --git a/Procfile b/Procfile index b371eef..e1d4131 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1 @@ web: node app.js -web: node deneme\app.js -web: node deneme/app.js From 1a1abb6e2aed1a29c1d609d627fc5e4e55ae0af3 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:45:48 +0200 Subject: [PATCH 16/72] 17 --- .idea/workspace.xml | 89 ++++++++++++++++++++++++++++++--------------- app.js | 4 +- 2 files changed, 60 insertions(+), 33 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 585175b..e1e0b57 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,7 @@ - + @@ -23,24 +23,44 @@ - + - - + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + - + @@ -57,8 +77,8 @@ @@ -260,20 +280,13 @@ - - - + + + - - - - - - - @@ -289,25 +302,41 @@ - + - - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app.js b/app.js index f35fab7..464dc04 100644 --- a/app.js +++ b/app.js @@ -123,10 +123,8 @@ var html1 = '123Herkese Yedir 1 \ \ \

23Herkese Yedir

\ -See the
asd \ - \ - \

All Documents in MonogoDB database

 ';
+
 var html2 = '
'; var html3 = ' documents. '; var html4 = '

Queried (name.last = "Doe", age >64)

 ';

From 7f970824ebaf6ce3e2dd7fa08ce6a7be60883de0 Mon Sep 17 00:00:00 2001
From: Umit Arslan 
Date: Sat, 20 Feb 2016 04:47:14 +0200
Subject: [PATCH 17/72] 16

---
 .idea/workspace.xml | 26 +++++++++++++-------------
 app.js              |  4 ++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e1e0b57..f99f93a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -26,12 +26,12 @@
       
         
           
-            
-              
+            
+              
               
-                
-                
-                
+                
+                
+                
               
             
           
@@ -280,9 +280,9 @@
         
           
           
-            
-            
-            
+            
+            
+            
           
         
       
@@ -328,12 +328,12 @@
     
     
       
-        
-          
+        
+          
           
-            
-            
-            
+            
+            
+            
           
         
       
diff --git a/app.js b/app.js
index 464dc04..e4bde64 100644
--- a/app.js
+++ b/app.js
@@ -117,12 +117,12 @@ console.log('CTRL+C to exit');
 
 
 // The rudimentary HTML content in three pieces.
-var html1 = '123Herkese Yedir 1 \
+var html1 = 'Sayfa Basligi Yedir \
  \
  \
  \
  \
-

23Herkese Yedir

\ +

123 Herkese Yedir

\

All Documents in MonogoDB database

 ';
 
 var html2 = '
'; From a31606fe06757d5d6bd2de8516361139da4d50d6 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 04:55:04 +0200 Subject: [PATCH 18/72] 17 --- .idea/workspace.xml | 67 ++++++++------------------------------------- app.js | 24 ++++++++-------- 2 files changed, 24 insertions(+), 67 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f99f93a..c49f29b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -22,52 +22,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -280,9 +235,9 @@ - - - + + + @@ -304,7 +259,7 @@
- + @@ -328,12 +283,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index e4bde64..181255e 100644 --- a/app.js +++ b/app.js @@ -49,9 +49,9 @@ PUser.remove({}, function(err) { // Creating one user. var bursa = new PUser ({ name: { first: 'Bursa', last: 'Dan' }, - age: 16, - Latitude:40.1234, - Longitude:29.1234 + plaka: 16, + Latitude: 40.266864, + Longitude:29.063448 }); // Saving it to the database. @@ -59,10 +59,10 @@ bursa.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, - Latitude:40, - Longitude:29 + name: { first: 'Giresun', last: 'Findik' }, + age: 28, + Latitude: 40.912811, + Longitude: 38.389530 }); janedoe.save(function (err) {if (err) console.log ('Error on save!')}); @@ -80,10 +80,12 @@ alicesmith.save(function (err) {if (err) console.log ('Error on save!')}); // 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); From 15bb200265a6c0796e8ca4ee12a58f243ed645cb Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:00:27 +0200 Subject: [PATCH 19/72] 18 --- .idea/workspace.xml | 37 ++++++++++++++++++++++++++----------- app.js | 32 +++++++++++++++++++------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c49f29b..568bdea 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -22,7 +22,22 @@ - + + + + + + + + + + + + + + + + - + + + - - @@ -235,9 +250,9 @@ - - - + + + @@ -284,11 +299,11 @@ - + - - - + + + diff --git a/app.js b/app.js index 181255e..1b15ff3 100644 --- a/app.js +++ b/app.js @@ -58,22 +58,22 @@ var bursa = new PUser ({ bursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually -var janedoe = new PUser ({ - name: { first: 'Giresun', last: 'Findik' }, +var giresun = new PUser ({ + name: { first: 'Giresun', last: 'Dan' }, age: 28, 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, - Latitude:40, - Longitude:29 +var istanbul = new PUser ({ + name: { first: 'Istanbul', last: 'Dan' }, + age: 34, + 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 @@ -91,14 +91,20 @@ http.createServer(function (req, res) { 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); + + + + + var query = PUser.find({'name.last': 'Dan'}); + query.where('age').lt(64); query.exec(function(err, result) { if (!err) { res.end(html4 + JSON.stringify(result, undefined, 2) + html5 + result.length + html6); @@ -124,7 +130,7 @@ var html1 = 'Sayfa Basligi Yedir \ \ \ \ -

123 Herkese Yedir

\ +

Herkese Yedir

\

All Documents in MonogoDB database

 ';
 
 var html2 = '
'; From 1ba9142cf43d30b6c94d668cf66c542a2fad8698 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:02:53 +0200 Subject: [PATCH 20/72] 19 --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 568bdea..8aa4509 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ - - + + - - - + + + @@ -250,9 +250,9 @@ - - - + + + @@ -298,12 +298,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index 1b15ff3..4084668 100644 --- a/app.js +++ b/app.js @@ -104,7 +104,7 @@ function createWebpage (req, res) { var query = PUser.find({'name.last': 'Dan'}); - query.where('age').lt(64); + query.where('age').lt(94); query.exec(function(err, result) { if (!err) { res.end(html4 + JSON.stringify(result, undefined, 2) + html5 + result.length + html6); From a24d8ee309c027f89bcd45ebf5cbf1d34dc535bc Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:05:11 +0200 Subject: [PATCH 21/72] 21 --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8aa4509..7b37e62 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ - - + + - - - + + + @@ -250,9 +250,9 @@ - - - + + + @@ -298,12 +298,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index 4084668..f3e0f6d 100644 --- a/app.js +++ b/app.js @@ -135,7 +135,7 @@ var html1 = 'Sayfa Basligi Yedir \ var html2 = '
'; var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age >64)

 ';
+var html4 = '

Queried (name.last = "Doe", age <94)

 ';
 var html5 = '
'; var html6 = ' documents. '; From ed2eeaf94284022c96410a8a08dfc6b4666d3ea2 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:07:30 +0200 Subject: [PATCH 22/72] 22 --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7b37e62..403c868 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ - - + + - - - + + + @@ -250,9 +250,9 @@ - - - + + + @@ -298,12 +298,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index f3e0f6d..f9c0ad3 100644 --- a/app.js +++ b/app.js @@ -104,10 +104,10 @@ function createWebpage (req, res) { var query = PUser.find({'name.last': 'Dan'}); - query.where('age').lt(94); + query.where('age').lt(93); query.exec(function(err, result) { if (!err) { - res.end(html4 + JSON.stringify(result, undefined, 2) + html5 + result.length + html6); + res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6); } else { res.end('Error in second query. ' + err) } @@ -135,7 +135,7 @@ var html1 = 'Sayfa Basligi Yedir \ var html2 = '
'; var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age <94)

 ';
+var html4 = '

Queried (name.last = "Doe", age <93)

 ';
 var html5 = '
'; var html6 = ' documents. '; From 6e8172ca24c5d690016920c9e3c321b26bedb4cb Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:09:21 +0200 Subject: [PATCH 23/72] 23 --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 403c868..a0eec4e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ - - + + - - - + + + @@ -250,9 +250,9 @@ - - - + + + @@ -298,12 +298,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index f9c0ad3..edfaf76 100644 --- a/app.js +++ b/app.js @@ -98,7 +98,7 @@ 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); + res.write(html1 + JSON.stringify(result, undefined, 3) + html2 + result.length + html3); @@ -135,7 +135,7 @@ var html1 = 'Sayfa Basligi Yedir \ var html2 = '
'; var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age <93)

 ';
+var html4 = '

Queried (name.last = "Doe", age < 95)

 ';
 var html5 = '
'; var html6 = ' documents. '; From a94381dccda78307deed4932051e4e7614f5be9f Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:11:51 +0200 Subject: [PATCH 24/72] 25 --- .idea/workspace.xml | 22 +++++++++++----------- app.js | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a0eec4e..76ce234 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -27,11 +27,11 @@ - + - - - + + + @@ -250,9 +250,9 @@ - - - + + + @@ -299,11 +299,11 @@ - + - - - + + + diff --git a/app.js b/app.js index edfaf76..148d85f 100644 --- a/app.js +++ b/app.js @@ -60,7 +60,7 @@ bursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var giresun = new PUser ({ name: { first: 'Giresun', last: 'Dan' }, - age: 28, + plaka: 28, Latitude: 40.912811, Longitude: 38.389530 }); @@ -69,7 +69,7 @@ giresun.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var istanbul = new PUser ({ name: { first: 'Istanbul', last: 'Dan' }, - age: 34, + plaka: 34, Latitude:41.00527, Longitude:28.97696 }); @@ -104,7 +104,7 @@ function createWebpage (req, res) { var query = PUser.find({'name.last': 'Dan'}); - query.where('age').lt(93); + query.where('plaka').lt(93); query.exec(function(err, result) { if (!err) { res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6); @@ -135,7 +135,7 @@ var html1 = 'Sayfa Basligi Yedir \ var html2 = '
'; var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age < 95)

 ';
+var html4 = '

Queried (name.last = "Doe", age < 93)

 ';
 var html5 = '
'; var html6 = ' documents. '; From a64ae7991fde0935140c5b985bc2f8571de6444c Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 05:24:10 +0200 Subject: [PATCH 25/72] 26 --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 76ce234..7b49368 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,12 +26,12 @@ - - + + - - - + + + @@ -250,9 +250,9 @@ - - - + + + @@ -298,12 +298,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index 148d85f..bf4a28a 100644 --- a/app.js +++ b/app.js @@ -30,7 +30,7 @@ var userSchema = new mongoose.Schema({ first: String, last: { type: String, trim: true } }, - age: { type: Number, min: 0}, + plaka: { type: Number, min: 0}, Latitude:{type: Number, min: 0}, Longitude:{type: Number, min: 0} }); @@ -135,7 +135,7 @@ var html1 = 'Sayfa Basligi Yedir \ var html2 = '
'; var html3 = ' documents. '; -var html4 = '

Queried (name.last = "Doe", age < 93)

 ';
+var html4 = '

Queried (name.last = "Dan", plaka < 93)

 ';
 var html5 = '
'; var html6 = ' documents. '; From 4fed5e2cca0300c6892c96fcbdc396669b262a1d Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sat, 20 Feb 2016 05:44:55 +0200 Subject: [PATCH 26/72] express.js direct --- .idea/workspace.xml | 238 ++++++++++++++++++++++++++++++++++++++------ public/404.html | 10 ++ public/basket.html | 18 ++++ public/express.js | 26 +++++ public/index.html | 18 ++++ public/login.html | 18 ++++ public/page.html | 10 ++ 7 files changed, 306 insertions(+), 32 deletions(-) create mode 100644 public/404.html create mode 100644 public/basket.html create mode 100644 public/express.js create mode 100644 public/index.html create mode 100644 public/login.html create mode 100644 public/page.html diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e701a17..c8a0a85 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,13 @@ + + + + + + - @@ -23,21 +28,74 @@ - - + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -47,6 +105,10 @@ @@ -56,10 +118,10 @@ true - @@ -86,8 +148,6 @@ - - @@ -108,16 +168,30 @@ + + - + - + + + + + + + + + + + + + @@ -141,6 +215,11 @@ + + + + + @@ -161,8 +240,21 @@ false + + + + + + + + + + + + + @@ -186,27 +278,46 @@ - - + + - + - - - + + + - - + + + - + + + + + + + + + + + + - + + + + + + + + - + \ No newline at end of file diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..4af1ce5 --- /dev/null +++ b/public/404.html @@ -0,0 +1,10 @@ + + + + + + + +

Error Page

+ + \ No newline at end of file diff --git a/public/basket.html b/public/basket.html new file mode 100644 index 0000000..d1b7819 --- /dev/null +++ b/public/basket.html @@ -0,0 +1,18 @@ + + + Express HTML + + + + + + +
+ + \ 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..3780532 --- /dev/null +++ b/public/index.html @@ -0,0 +1,18 @@ + + + Express HTML + + + + + + +
+
+

Hello, world!

+

Yedir

+

Learn more

+
+
+ + \ No newline at end of file diff --git a/public/login.html b/public/login.html new file mode 100644 index 0000000..fac5044 --- /dev/null +++ b/public/login.html @@ -0,0 +1,18 @@ + + + Express HTML + + + + + + +
+
+

Login or Sign Up

+

Yedir

+

Learn more

+
+
+ + \ 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 From 063b20d7b8db4a90580a835f8de15503e47c9977 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 06:01:37 +0200 Subject: [PATCH 27/72] 26 --- .idea/workspace.xml | 29 +++++++++++++++-------------- app.js | 27 +++++++++++++++++++-------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7b49368..4157820 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,6 +2,7 @@ + @@ -26,12 +27,12 @@ - - + + - - - + + + @@ -207,7 +208,7 @@ - + @@ -250,9 +251,9 @@ - - - + + + @@ -298,12 +299,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index bf4a28a..25104cb 100644 --- a/app.js +++ b/app.js @@ -30,9 +30,14 @@ var userSchema = new mongoose.Schema({ first: String, last: { type: String, trim: true } }, + + koordinat:{ + Latitude:{type: Number, min: 0}, + Longitude:{type: Number, min: 0} + }, + plaka: { type: Number, min: 0}, - Latitude:{type: Number, min: 0}, - Longitude:{type: Number, min: 0} + }); // Compiles the schema into a model, opening (or creating, if @@ -50,8 +55,10 @@ PUser.remove({}, function(err) { var bursa = new PUser ({ name: { first: 'Bursa', last: 'Dan' }, plaka: 16, - Latitude: 40.266864, - Longitude:29.063448 + koordinat: { + Latitude: 40.266864, + Longitude: 29.063448 + } }); // Saving it to the database. @@ -61,8 +68,10 @@ bursa.save(function (err) {if (err) console.log ('Error on save!')}); var giresun = new PUser ({ name: { first: 'Giresun', last: 'Dan' }, plaka: 28, - Latitude: 40.912811, - Longitude: 38.389530 + koordinat: { + Latitude: 40.912811, + Longitude: 38.389530 + } }); giresun.save(function (err) {if (err) console.log ('Error on save!')}); @@ -70,8 +79,10 @@ giresun.save(function (err) {if (err) console.log ('Error on save!')}); var istanbul = new PUser ({ name: { first: 'Istanbul', last: 'Dan' }, plaka: 34, - Latitude:41.00527, - Longitude:28.97696 + koordinat: { + Latitude: 41.00527, + Longitude: 28.97696 + } }); istanbul.save(function (err) {if (err) console.log ('Error on save!')}); From 95d85cbfbfdab34c8ed765955b266d6708bd0c86 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 06:09:07 +0200 Subject: [PATCH 28/72] 30 30 --- .idea/workspace.xml | 27 +++++++++++++-------------- app.js | 3 --- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4157820..930219e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,6 @@ - @@ -27,12 +26,12 @@ - - + + - - - + + + @@ -251,9 +250,9 @@ - - - + + + @@ -299,12 +298,12 @@ - - + + - - - + + + diff --git a/app.js b/app.js index 25104cb..339c8b0 100644 --- a/app.js +++ b/app.js @@ -94,9 +94,6 @@ var found = ['DB Connection not yet established. Try again later. Check the co - - - http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); createWebpage(req, res); From d744b8b68135aaf7960071bdc3c7d52a0186ff32 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 06:10:05 +0200 Subject: [PATCH 29/72] 123 123 --- .idea/workspace.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 930219e..97d9776 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,7 @@ - - - + - + - - + + @@ -248,9 +249,8 @@ - - - + + @@ -274,7 +274,6 @@ - @@ -282,7 +281,6 @@ - @@ -290,18 +288,16 @@ - - - + + - - - + + diff --git a/app.js b/app.js index 339c8b0..0afdb0d 100644 --- a/app.js +++ b/app.js @@ -100,8 +100,6 @@ http.createServer(function (req, res) { }).listen(theport); - - function createWebpage (req, res) { // Let's find all the documents PUser.find({}).exec(function(err, result) { From d0a6d754143ef6c263214d533baffc035de22a80 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 17:22:47 +0200 Subject: [PATCH 31/72] 33 --- .idea/workspace.xml | 41 ++++++++++++++++++++++++++--------------- app.js | 4 ++++ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3953bb3..680a73a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,16 +26,26 @@ - - + + - - + + + + + + + + + + + + @@ -57,8 +67,8 @@ true - @@ -200,26 +210,26 @@ - + + + - - @@ -249,8 +259,8 @@ - - + + @@ -288,16 +298,17 @@ + - - + + - - + + diff --git a/app.js b/app.js index 0afdb0d..7947359 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,10 @@ var http = require ('http'); // For serving a basic web page. var mongoose = require ("mongoose"); // The reason for this demo. +var express = require("express"); +var socketio = require("socket.io"); + + // Here we find an appropriate database to connect to, defaulting to // localhost if we don't find one. From a11898e086e31a2a51dba18f9b38fcc46f88b287 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 17:27:48 +0200 Subject: [PATCH 32/72] res --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 5 ++--- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 680a73a..a45c631 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,11 +26,11 @@ - - + + - - + + @@ -67,8 +67,8 @@ true - @@ -210,7 +210,7 @@ - + @@ -259,8 +259,8 @@ - - + + @@ -304,11 +304,11 @@ - - + + - - + + diff --git a/app.js b/app.js index 7947359..02b74c3 100644 --- a/app.js +++ b/app.js @@ -111,13 +111,11 @@ function createWebpage (req, res) { res.write(html1 + JSON.stringify(result, undefined, 3) + html2 + result.length + html3); - - var query = PUser.find({'name.last': 'Dan'}); query.where('plaka').lt(93); query.exec(function(err, result) { if (!err) { - res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6); + res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6 + html7); } else { res.end('Error in second query. ' + err) } @@ -148,4 +146,5 @@ var html3 = ' documents. '; var html4 = '

Queried (name.last = "Dan", plaka < 93)

 ';
 var html5 = '
'; var html6 = ' documents. '; +var html7 = 'Smiley face '; From 9dda632ed9eb87deb6c5a2f7fa72f74bd081aa9e Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 17:30:57 +0200 Subject: [PATCH 33/72] res1 --- .idea/workspace.xml | 16 ++++++++-------- app.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a45c631..cc42e66 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -27,10 +27,10 @@ - + - - + + @@ -259,8 +259,8 @@ - - + + @@ -305,10 +305,10 @@ - + - - + + diff --git a/app.js b/app.js index 02b74c3..ba32b18 100644 --- a/app.js +++ b/app.js @@ -135,7 +135,7 @@ console.log('CTRL+C to exit'); // The rudimentary HTML content in three pieces. var html1 = 'Sayfa Basligi Yedir \ \ - \ + \ \ \

Herkese Yedir

\ @@ -146,5 +146,5 @@ var html3 = ' documents. '; var html4 = '

Queried (name.last = "Dan", plaka < 93)

 ';
 var html5 = '
'; var html6 = ' documents. '; -var html7 = 'Smiley face '; +var html7 = ''; From c43e8cb9f9e2fe242d404b1731ccd957fd0f198f Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:00:08 +0200 Subject: [PATCH 34/72] 33_ --- .idea/workspace.xml | 20 ++++---- app.js | 113 ++++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 67 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index cc42e66..d108832 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,11 +26,11 @@ - - + + - - + + @@ -259,8 +259,8 @@ - - + + @@ -304,11 +304,11 @@ - - + + - - + + diff --git a/app.js b/app.js index ba32b18..7111310 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,3 @@ - var http = require ('http'); // For serving a basic web page. var mongoose = require ("mongoose"); // The reason for this demo. var express = require("express"); @@ -20,27 +19,27 @@ 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 } - }, + name: { + first: String, + last: { type: String, trim: true } + }, - koordinat:{ - Latitude:{type: Number, min: 0}, - Longitude:{type: Number, min: 0} - }, + koordinat:{ + Latitude:{type: Number, min: 0}, + Longitude:{type: Number, min: 0} + }, - plaka: { type: Number, min: 0}, + plaka: { type: Number, min: 0}, }); @@ -50,19 +49,19 @@ var PUser = mongoose.model('PowerUsers', userSchema); // 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 bursa = new PUser ({ - name: { first: 'Bursa', last: 'Dan' }, - plaka: 16, - koordinat: { - Latitude: 40.266864, - Longitude: 29.063448 - } + name: { first: 'Bursa', last: 'Dan' }, + plaka: 16, + koordinat: { + Latitude: 40.266864, + Longitude: 29.063448 + } }); // Saving it to the database. @@ -70,23 +69,23 @@ bursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var giresun = new PUser ({ - name: { first: 'Giresun', last: 'Dan' }, - plaka: 28, - koordinat: { - Latitude: 40.912811, - Longitude: 38.389530 - } + name: { first: 'Giresun', last: 'Dan' }, + plaka: 28, + koordinat: { + Latitude: 40.912811, + Longitude: 38.389530 + } }); giresun.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var istanbul = new PUser ({ - name: { first: 'Istanbul', last: 'Dan' }, - plaka: 34, - koordinat: { - Latitude: 41.00527, - Longitude: 28.97696 - } + name: { first: 'Istanbul', last: 'Dan' }, + plaka: 34, + koordinat: { + Latitude: 41.00527, + Longitude: 28.97696 + } }); istanbul.save(function (err) {if (err) console.log ('Error on save!')}); @@ -99,31 +98,33 @@ var found = ['DB Connection not yet established. Try again later. Check the co 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, 3) + html2 + result.length + html3); + // 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('plaka').lt(93); - query.exec(function(err, result) { - if (!err) { - res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6 + html7); + + + var query = PUser.find({'name.last': 'Dan'}); + query.where('plaka').lt(93); + query.exec(function(err, result) { + if (!err) { + res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6); + } else { + res.end('Error in second query. ' + err) + } + }); } else { - res.end('Error in second query. ' + err) + res.end('Error in first query. ' + err) } - }); - } else { - res.end('Error in first query. ' + err) - } - }); + }); } // Tell the console we're getting ready. @@ -135,7 +136,7 @@ console.log('CTRL+C to exit'); // The rudimentary HTML content in three pieces. var html1 = 'Sayfa Basligi Yedir \ \ - \ + \ \ \

Herkese Yedir

\ @@ -145,6 +146,4 @@ var html2 = '
'; var html3 = ' documents. '; var html4 = '

Queried (name.last = "Dan", plaka < 93)

 ';
 var html5 = '
'; -var html6 = ' documents. '; -var html7 = ''; - +var html6 = ' documents. '; \ No newline at end of file From ece9361dafdbd7315e317fe8bef45921bc8ca165 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:05:25 +0200 Subject: [PATCH 35/72] 332 --- .idea/workspace.xml | 41 +++++++++++++++++++++++++---------------- app.js | 2 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d108832..94fc5ca 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,11 +26,11 @@ - - + + - - + + @@ -67,8 +67,8 @@ true - @@ -209,17 +209,27 @@ - - + + - - + + diff --git a/app.js b/app.js index 7111310..6354453 100644 --- a/app.js +++ b/app.js @@ -39,7 +39,7 @@ var userSchema = new mongoose.Schema({ Longitude:{type: Number, min: 0} }, - plaka: { type: Number, min: 0}, + plaka: { type: Number, min: 0} }); From 93508a4101aaaa02b45c1709d49b78a8ef8f2a70 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:09:23 +0200 Subject: [PATCH 36/72] ds --- .idea/workspace.xml | 26 +++++++++++++------------- app.js | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 94fc5ca..de06c9c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,11 +26,11 @@ - - + + - - + + @@ -67,8 +67,8 @@ true - @@ -219,7 +219,7 @@ - + @@ -268,8 +268,8 @@ - - + + @@ -313,11 +313,11 @@ - - + + - - + + diff --git a/app.js b/app.js index 6354453..5ce61c0 100644 --- a/app.js +++ b/app.js @@ -10,7 +10,7 @@ var socketio = require("socket.io"); var uristring = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || - 'mongodb://localhost/HelloMongoose'; + 'mongodb://heroku_z802lth6:8uoqc89ntqifsm7undqksf2cfq@ds055935.mongolab.com:55935/heroku_z802lth6'; // The http server will listen to an appropriate port, or default to // port 5000. From f3cf062fcfd09183cb94ed42868f81806508bc98 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:18:12 +0200 Subject: [PATCH 37/72] 23 --- .idea/workspace.xml | 187 +++++++++++++++++++++++++++++++++++++------- README.md | 46 ++--------- app.js | 8 +- app.json | 2 +- package.json | 2 +- 5 files changed, 171 insertions(+), 74 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index de06c9c..e5acbfb 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,11 @@ + + + + @@ -26,11 +30,11 @@ - - + + - - + + @@ -39,8 +43,8 @@ - - + + @@ -54,9 +58,11 @@ @@ -67,9 +73,9 @@ true - @@ -97,7 +103,6 @@ - @@ -119,6 +124,7 @@ + @@ -219,26 +225,26 @@ - + - - + + - - - + + + @@ -266,15 +272,15 @@ - + - - + + - + @@ -282,27 +288,85 @@ - + - - + + + - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -313,11 +377,74 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/README.md b/README.md index 3eb83ff..e39d5ae 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,11 @@ -# hello-mongoose: Using Mongoose.js for elegant MongoDB object modeling in Node.js. - -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 [![Deploy](https://www.herokucdn.com/deploy/button.png)](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` +To deploy [the app](http://serene-woodland-88772.herokuapp.com/) to Heroku you can use the Heroku button [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) or follow these steps: + + +1. `heroku create` +2. `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 +4. `heroku open` \ No newline at end of file diff --git a/app.js b/app.js index 5ce61c0..d2cb986 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ -var http = require ('http'); // For serving a basic web page. -var mongoose = require ("mongoose"); // The reason for this demo. -var express = require("express"); -var socketio = require("socket.io"); +var http = require ('http'); // For serving a basic web page. +var mongoose = require ("mongoose"); +var express = require ("express"); +var socketio = require ("socket.io"); diff --git a/app.json b/app.json index 05d0340..ee1b500 100644 --- a/app.json +++ b/app.json @@ -2,7 +2,7 @@ "name": "hello-mongoose", "description": "MongoDB with Mongoose on Node.js example", "image": "heroku/nodejs", - "repository": "https://github.com/mongolab/hello-mongoose.git", + "repository": "https://github.com/arslanmit/yedir.git", "keywords": ["node", "mongoose", "ODM"], "addons": ["mongolab"] } diff --git a/package.json b/package.json index b362c89..e7e5290 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "mongoose": ">=4.1.11" }, "changelog" : [{"0.0.0": "Initial release"}, - {"0.1.0": "Update to Mongoose 3.5.7; new MongoClient semantics"}, + {"0.1.0": "Update to Mongoose 3.5.7; new MongoClient semantics"}, {"0.2.0": "Update to Mongoose 3.8.15; updated Node engine to 0.10.31; updated npm engine to >=1.4"}, {"0.3.0": "Update to Mongoose >=4.1.11; updated Node engine to >=4.1.1; updated npm engine to >=2.1.x"}], "homepage" : "http://hello-mongoose.herokuapp.com" From ab29dff851d793ab61350f4643b1e4697df60605 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:36:02 +0200 Subject: [PATCH 38/72] we --- .idea/workspace.xml | 100 ++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 40 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e5acbfb..db3c4a5 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,13 +1,7 @@ - - - - - - - + - + - + @@ -50,6 +44,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -226,9 +246,9 @@ - + - + @@ -386,34 +406,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -440,7 +432,7 @@ - + @@ -449,5 +441,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 3cafed7c5d2796284337864de8f36d4c9de2d117 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:42:05 +0200 Subject: [PATCH 39/72] w --- .idea/workspace.xml | 118 ++++++++++++++++++-------------------------- app.js | 4 +- 2 files changed, 49 insertions(+), 73 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index db3c4a5..d546a2e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,9 @@ - + + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -93,10 +69,10 @@ true - @@ -245,10 +221,10 @@ - - + + - + @@ -294,8 +270,8 @@ - - + + @@ -351,8 +327,8 @@ - - + + @@ -400,8 +376,8 @@ - - + + @@ -414,36 +390,17 @@ - - - - - - - - - + - - - - - - - - - - - - + @@ -452,7 +409,7 @@ - + @@ -469,5 +426,24 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app.js b/app.js index d2cb986..3f01672 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ var http = require ('http'); // For serving a basic web page. var mongoose = require ("mongoose"); -var express = require ("express"); -var socketio = require ("socket.io"); +//var express = require ("express"); +//var socketio = require ("socket.io"); From d3cd5be50a0b2e0dace742fda73e8433055d2ca0 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 19:46:18 +0200 Subject: [PATCH 40/72] asd --- .idea/workspace.xml | 34 +++++++++++++++++----------------- app.js | 5 +++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d546a2e..8297ed6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -26,11 +26,11 @@ - - + + - - + + @@ -69,8 +69,8 @@ true - @@ -221,7 +221,7 @@ - + @@ -270,8 +270,8 @@ - - + + @@ -327,8 +327,8 @@ - - + + @@ -376,8 +376,8 @@ - - + + @@ -436,11 +436,11 @@ - - + + - - + + diff --git a/app.js b/app.js index 3f01672..e7a72a4 100644 --- a/app.js +++ b/app.js @@ -116,7 +116,7 @@ function createWebpage (req, res) { query.where('plaka').lt(93); query.exec(function(err, result) { if (!err) { - res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6); + res.end(html4 + JSON.stringify(result, undefined, 3) + html5 + result.length + html6 + html7); } else { res.end('Error in second query. ' + err) } @@ -146,4 +146,5 @@ var html2 = '
'; var html3 = ' documents. '; var html4 = '

Queried (name.last = "Dan", plaka < 93)

 ';
 var html5 = '
'; -var html6 = ' documents. '; \ No newline at end of file +var html6 = ' documents. '; +var html7 = 'Smiley face '; From 6fc56813ef2414f040d78a9322e324e74f5ffaff Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 21:14:07 +0200 Subject: [PATCH 41/72] geo --- app.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index e7a72a4..561c63a 100644 --- a/app.js +++ b/app.js @@ -34,18 +34,28 @@ var userSchema = new mongoose.Schema({ last: { type: String, trim: true } }, + plaka: { type: Number, min: 0}, + koordinat:{ Latitude:{type: Number, min: 0}, Longitude:{type: Number, min: 0} - }, + } - plaka: { type: Number, min: 0} +}); +//geo +var GeoSchema = new mongoose.Schema({ + location: { 'type': {type: String, enum: "Point", default: "Point"}, + coordinates: { type: [Number], default: [0,0]} } }); + + // 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); +var GeoJSON = mongoose.model('GeoJSON', GeoSchema); + // Clear out old data PUser.remove({}, function(err) { @@ -54,6 +64,14 @@ PUser.remove({}, function(err) { } }); +GeoJSON.remove({}, function(err) { + if (err) { + console.log ('error deleting old data.'); + } +}); + + + // Creating one user. var bursa = new PUser ({ name: { first: 'Bursa', last: 'Dan' }, @@ -63,9 +81,16 @@ var bursa = new PUser ({ Longitude: 29.063448 } }); +var GeoBursa = new GeoJSON ({ + location: 'Bursa', + coordinates:[ 40.266864,29.063448] } +); + // 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!')}); + // Creating more users manually var giresun = new PUser ({ From f1d3a8677415131f3a5a11f22bb92606eea43ac8 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 21:28:58 +0200 Subject: [PATCH 42/72] d --- .gitignore | 3 ++ .idea/jsLibraryMappings.xml | 1 + .idea/workspace.xml | 95 ++++++++++++++++++++++--------------- .idea/yedir.iml | 1 + 4 files changed, 61 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 4ba468b..20b6656 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ results node_modules npm-debug.log + +*.xml + diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index d23208f..b7dfd0e 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,7 @@ + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8297ed6..677322f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,10 @@ - + + + + @@ -23,24 +26,24 @@ - + - - + + - - + + - + - - + + @@ -60,6 +63,7 @@ @@ -69,10 +73,10 @@ true
- @@ -99,6 +103,7 @@ + @@ -120,7 +125,6 @@ - @@ -221,10 +225,10 @@ - + - + @@ -265,13 +269,32 @@ + + + + + + + + + + + + + + + + + + + - - + + @@ -296,7 +319,6 @@ - @@ -318,7 +340,6 @@ - @@ -327,8 +348,8 @@ - - + + @@ -345,7 +366,6 @@ - @@ -367,7 +387,6 @@ - @@ -376,8 +395,8 @@ - - + + @@ -394,7 +413,6 @@ - @@ -402,7 +420,6 @@ - @@ -426,22 +443,22 @@ - + - - - + + + + + + - + - - - - - - + + + diff --git a/.idea/yedir.iml b/.idea/yedir.iml index c956989..88da23d 100644 --- a/.idea/yedir.iml +++ b/.idea/yedir.iml @@ -4,5 +4,6 @@ + \ No newline at end of file From 51378a24712ae422fb0da03d5f4c51e133e6052f Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 21:48:47 +0200 Subject: [PATCH 43/72] as --- .gitignore | 6 ++++++ app.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 20b6656..482e85e 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,9 @@ npm-debug.log *.xml + +.idea/workspace.xml + +.idea/workspace.xml + +.idea/workspace.xml diff --git a/app.js b/app.js index 561c63a..71552d0 100644 --- a/app.js +++ b/app.js @@ -83,7 +83,8 @@ var bursa = new PUser ({ }); var GeoBursa = new GeoJSON ({ location: 'Bursa', - coordinates:[ 40.266864,29.063448] } + // coordinates:[ 40.266864,29.063448] } + coordinates:[ 40,29] } ); From 572bc4d8aac339aca6cd16b5a3c0187f5fe2f925 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sat, 20 Feb 2016 22:48:01 +0200 Subject: [PATCH 44/72] 1 --- .idea/workspace.xml | 105 +++++++++++++++++++++++--------------------- app.js | 10 ++--- 2 files changed, 60 insertions(+), 55 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 677322f..3f6f752 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,8 @@ - - - + @@ -26,29 +24,19 @@ - + - - + + - - + + - - - - - - - - - - @@ -62,8 +50,8 @@ @@ -73,10 +61,10 @@ true
- @@ -122,6 +110,20 @@ - + - + @@ -274,8 +276,8 @@ - - + + @@ -293,8 +295,8 @@ - - + + @@ -340,6 +342,7 @@ + @@ -348,8 +351,8 @@ - - + + @@ -387,6 +390,7 @@ + @@ -395,8 +399,8 @@ - - + + @@ -409,13 +413,6 @@ - - - - - - - @@ -443,24 +440,32 @@ - + - - - - - - + + + - + - - + + + + + + + + + + + + +
\ No newline at end of file diff --git a/app.js b/app.js index 71552d0..a475042 100644 --- a/app.js +++ b/app.js @@ -34,7 +34,7 @@ var userSchema = new mongoose.Schema({ last: { type: String, trim: true } }, - plaka: { type: Number, min: 0}, + tel: { type: Number, min: 0}, koordinat:{ Latitude:{type: Number, min: 0}, @@ -46,7 +46,7 @@ var userSchema = new mongoose.Schema({ //geo var GeoSchema = new mongoose.Schema({ location: { 'type': {type: String, enum: "Point", default: "Point"}, - coordinates: { type: [Number], default: [0,0]} } + coordinates: { type: [Number,Number], default: [0,0]} } }); @@ -75,7 +75,7 @@ GeoJSON.remove({}, function(err) { // Creating one user. var bursa = new PUser ({ name: { first: 'Bursa', last: 'Dan' }, - plaka: 16, + tel: 16, koordinat: { Latitude: 40.266864, Longitude: 29.063448 @@ -96,7 +96,7 @@ GeoBursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var giresun = new PUser ({ name: { first: 'Giresun', last: 'Dan' }, - plaka: 28, + tel: 28, koordinat: { Latitude: 40.912811, Longitude: 38.389530 @@ -107,7 +107,7 @@ giresun.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var istanbul = new PUser ({ name: { first: 'Istanbul', last: 'Dan' }, - plaka: 34, + tel: 34, koordinat: { Latitude: 41.00527, Longitude: 28.97696 From 0e1366e79cbc18e1b62c5a15a32ce58698657218 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 00:58:19 +0200 Subject: [PATCH 45/72] asd --- app.js | 50 +++++++++++++++----------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/app.js b/app.js index a475042..b2f7e59 100644 --- a/app.js +++ b/app.js @@ -1,23 +1,16 @@ -var http = require ('http'); // For serving a basic web page. +var http = require ('http'); var mongoose = require ("mongoose"); //var express = require ("express"); //var socketio = require ("socket.io"); - - -// 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://heroku_z802lth6:8uoqc89ntqifsm7undqksf2cfq@ds055935.mongolab.com:55935/heroku_z802lth6'; -// The http server will listen to an appropriate port, or default to -// port 5000. 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); @@ -26,33 +19,22 @@ mongoose.connect(uristring, function (err, res) { } }); -// 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 } - }, +var userSchema = new mongoose.Schema({ 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,Number], default: [0,0]} } + 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 GeoJSON = mongoose.model('GeoJSON', GeoSchema); @@ -64,17 +46,11 @@ PUser.remove({}, function(err) { } }); -GeoJSON.remove({}, function(err) { - if (err) { - console.log ('error deleting old data.'); - } -}); - - +// GeoJSON.remove({}, function(err) {if (err) {console.log ('error deleting old data.');}}); -// Creating one user. +//insert var bursa = new PUser ({ - name: { first: 'Bursa', last: 'Dan' }, + tel: 16, koordinat: { Latitude: 40.266864, @@ -83,8 +59,12 @@ var bursa = new PUser ({ }); var GeoBursa = new GeoJSON ({ location: 'Bursa', - // coordinates:[ 40.266864,29.063448] } - coordinates:[ 40,29] } + // coordinates:[ 40.266864,29.063448] }, + + coordinates.0: {40}, + coordinates.1: {29}, + +} ); @@ -95,7 +75,7 @@ GeoBursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var giresun = new PUser ({ - name: { first: 'Giresun', last: 'Dan' }, + // name: { first: 'Giresun', last: 'Dan' }, tel: 28, koordinat: { Latitude: 40.912811, @@ -106,7 +86,7 @@ giresun.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually var istanbul = new PUser ({ - name: { first: 'Istanbul', last: 'Dan' }, + // name: { first: 'Istanbul', last: 'Dan' }, tel: 34, koordinat: { Latitude: 41.00527, From c2f2b83571d963af5e105de590e8bcfe73e33c3c Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 02:36:58 +0200 Subject: [PATCH 46/72] 12 --- app.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app.js b/app.js index b2f7e59..24a6b93 100644 --- a/app.js +++ b/app.js @@ -30,11 +30,12 @@ var userSchema = new mongoose.Schema({ //geo var GeoSchema = new mongoose.Schema({ - location: { 'type': {type: String, enum: "Point", default: "Point"}, - coordinates: { type: [Number], default: [1,2]} } + location: { type: {type: String, enum: "Point", default: "Point"}, + coordinates: { type: [Number]default: [1,2]} } }); + var PUser = mongoose.model('PowerUsers', userSchema); var GeoJSON = mongoose.model('GeoJSON', GeoSchema); @@ -57,15 +58,11 @@ var bursa = new PUser ({ Longitude: 29.063448 } }); -var GeoBursa = new GeoJSON ({ - location: 'Bursa', - // coordinates:[ 40.266864,29.063448] }, - coordinates.0: {40}, - coordinates.1: {29}, +var GeoBursa = new GeoJSON ({ + location:{"Bursa"} -} -); +}); // Saving it to the database. From ac2e38645cb4711df68ed6fb2647c3da40121f9a Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 02:39:33 +0200 Subject: [PATCH 47/72] 123 --- app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 24a6b93..6d062ae 100644 --- a/app.js +++ b/app.js @@ -30,11 +30,11 @@ var userSchema = new mongoose.Schema({ //geo var GeoSchema = new mongoose.Schema({ - location: { type: {type: String, enum: "Point", default: "Point"}, - coordinates: { type: [Number]default: [1,2]} } + location: { 'type': {type: String, enum: "Point", default: "Point"}, + coordinates: { type: [Number],default: [1,2]} } }); - +//, default: [1,2] var PUser = mongoose.model('PowerUsers', userSchema); var GeoJSON = mongoose.model('GeoJSON', GeoSchema); @@ -60,7 +60,7 @@ var bursa = new PUser ({ }); var GeoBursa = new GeoJSON ({ - location:{"Bursa"} + location:'Bursa' }); From 690e6137b795dac400654793666eb5d5e47e2c4e Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 02:56:15 +0200 Subject: [PATCH 48/72] ekran --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4ba468b..0c2e1a3 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ results node_modules npm-debug.log +*.xml From c499d07f5c070d56cf06f9162b6e04c70aed4779 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 03:01:19 +0200 Subject: [PATCH 49/72] ekran angular --- public/angularr.js | 19 +++++++++ public/index.html | 102 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 108 insertions(+), 13 deletions(-) create mode 100644 public/angularr.js diff --git a/public/angularr.js b/public/angularr.js new file mode 100644 index 0000000..75e95dc --- /dev/null +++ b/public/angularr.js @@ -0,0 +1,19 @@ +/** + * Created by özge on 2/20/2016. + */ +var app = angular.module('myApp', []) +console.log("buarafa") +app.controller('FormCtrl', function ($scope, $http) { + + $scope.data = { + firstname: "default", + emailaddress: "default", + attitude: 0, + longitude: 0, + + }; + $scope.submitForm = function() { + console.log("posting data...."); + $http.post('http://posttestserver.com/post.php?dir=jsfiddle', JSON.stringify(data)).success(function(){/*success callback*/}); + }; +}); \ No newline at end of file diff --git a/public/index.html b/public/index.html index 3780532..60a90b7 100644 --- a/public/index.html +++ b/public/index.html @@ -1,18 +1,94 @@ - + - Express HTML - - - - + Yedir - -
-
-

Hello, world!

-

Yedir

-

Learn more

+ + + + + + + + +
+
+

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.

+
+
+
+
+ Yemek istegi icin formu doldurunuz +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+

form = {{user }}

+
+
+
+
+ Yemek bağışı yapmak için formu doldurunuz +

Yemek bağıs bedeli öğün başına 5 tl'dir. Ödemenizi kredi kartınızlar yapabilirsiniz.

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+
+ + + - \ No newline at end of file + From 8d50e4f05655c7c408d5884c95f795830b75aa8d Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 03:17:02 +0200 Subject: [PATCH 50/72] 1221 --- .idea/jsLibraryMappings.xml | 2 +- .idea/yedir.iml | 1 + app.js | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index d23208f..dfb0ed4 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/yedir.iml b/.idea/yedir.iml index c956989..88da23d 100644 --- a/.idea/yedir.iml +++ b/.idea/yedir.iml @@ -4,5 +4,6 @@ + \ No newline at end of file diff --git a/app.js b/app.js index 6d062ae..60fa49f 100644 --- a/app.js +++ b/app.js @@ -30,8 +30,9 @@ var userSchema = new mongoose.Schema({ //geo var GeoSchema = new mongoose.Schema({ - location: { 'type': {type: String, enum: "Point", default: "Point"}, - coordinates: { type: [Number],default: [1,2]} } + location: { + 'type': {type: String, enum: "Point", default: "Point"}, coordinates: { type: [Number],default: [1,2]} + } }); //, default: [1,2] @@ -60,7 +61,9 @@ var bursa = new PUser ({ }); var GeoBursa = new GeoJSON ({ - location:'Bursa' + location: {type: String, enum: "Point", default: "Point"}, coordinates: { type: [Number],default: [1,2]} + 'Bursa', + location.coordinates: [ -73.97, 40.77 ] }); From 2a7adf9ced03363ed5e652ff13de91881d350e49 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 03:18:25 +0200 Subject: [PATCH 51/72] deneme --- public/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/index.html b/public/index.html index 60a90b7..5efde93 100644 --- a/public/index.html +++ b/public/index.html @@ -85,6 +85,8 @@

Yedir'e Hosgeldiniz.

$scope.sub = function() { $scope.user = angular.copy($scope.master); console.log("ozge taggag"); + $scope.statusText("loading"); + }; $scope.sub(); }); From 57fa07331e9249156731bf85e430ddbcfff6f9f5 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 03:19:17 +0200 Subject: [PATCH 52/72] comm --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 5efde93..8c19fe9 100644 --- a/public/index.html +++ b/public/index.html @@ -86,7 +86,7 @@

Yedir'e Hosgeldiniz.

$scope.user = angular.copy($scope.master); console.log("ozge taggag"); $scope.statusText("loading"); - + }; $scope.sub(); }); From befd3fab95ab6525cbc7fb09bdd111fb2ac1050b Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 03:29:51 +0200 Subject: [PATCH 53/72] 12 --- README.md | 36 ------------------------------------ app.js | 20 ++++++++++---------- package.json | 2 +- 3 files changed, 11 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 3eb83ff..25f2ce3 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,5 @@ -# hello-mongoose: Using Mongoose.js for elegant MongoDB object modeling in Node.js. -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 [![Deploy](https://www.herokucdn.com/deploy/button.png)](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 diff --git a/app.js b/app.js index 60fa49f..f743269 100644 --- a/app.js +++ b/app.js @@ -10,6 +10,7 @@ var uristring = var theport = process.env.PORT || 5000; +/* mongoose.connect(uristring, function (err, res) { if (err) { @@ -18,6 +19,7 @@ mongoose.connect(uristring, function (err, res) { console.log ('Succeeded connected to: ' + uristring); } }); +*/ var userSchema = new mongoose.Schema({ @@ -29,16 +31,16 @@ var userSchema = new mongoose.Schema({ }); //geo -var GeoSchema = new mongoose.Schema({ +/*var GeoSchema = new mongoose.Schema({ location: { 'type': {type: String, enum: "Point", default: "Point"}, coordinates: { type: [Number],default: [1,2]} } -}); +});*/ //, default: [1,2] var PUser = mongoose.model('PowerUsers', userSchema); -var GeoJSON = mongoose.model('GeoJSON', GeoSchema); +//var GeoJSON = mongoose.model('GeoJSON', GeoSchema); // Clear out old data @@ -48,7 +50,7 @@ PUser.remove({}, function(err) { } }); -// GeoJSON.remove({}, function(err) {if (err) {console.log ('error deleting old data.');}}); +//GeoJSON.remove({}, function(err) {if (err) {console.log ('error deleting old data.');}}); //insert var bursa = new PUser ({ @@ -59,18 +61,16 @@ var bursa = new PUser ({ Longitude: 29.063448 } }); - +/* var GeoBursa = new GeoJSON ({ - location: {type: String, enum: "Point", default: "Point"}, coordinates: { type: [Number],default: [1,2]} - 'Bursa', - location.coordinates: [ -73.97, 40.77 ] + 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!')}); +//GeoBursa.save(function (err) {if (err) console.log ('Error on save!')}); // Creating more users manually diff --git a/package.json b/package.json index b362c89..94431ac 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "mongoose": ">=4.1.11" }, "changelog" : [{"0.0.0": "Initial release"}, - {"0.1.0": "Update to Mongoose 3.5.7; new MongoClient semantics"}, + {"0.1.0": "Update to Mongoose 3.5.7; new MongoClient semantics"}, {"0.2.0": "Update to Mongoose 3.8.15; updated Node engine to 0.10.31; updated npm engine to >=1.4"}, {"0.3.0": "Update to Mongoose >=4.1.11; updated Node engine to >=4.1.1; updated npm engine to >=2.1.x"}], "homepage" : "http://hello-mongoose.herokuapp.com" From b75869b2a94a3ca870808d8d4b5e42febe4cf2bc Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 03:34:07 +0200 Subject: [PATCH 54/72] asd --- app.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index f743269..4d0dd50 100644 --- a/app.js +++ b/app.js @@ -10,7 +10,7 @@ var uristring = var theport = process.env.PORT || 5000; -/* + mongoose.connect(uristring, function (err, res) { if (err) { @@ -19,7 +19,7 @@ mongoose.connect(uristring, function (err, res) { console.log ('Succeeded connected to: ' + uristring); } }); -*/ + var userSchema = new mongoose.Schema({ @@ -31,16 +31,16 @@ var userSchema = new mongoose.Schema({ }); //geo -/*var GeoSchema = new mongoose.Schema({ +var GeoSchema = new mongoose.Schema({ location: { 'type': {type: String, enum: "Point", default: "Point"}, coordinates: { type: [Number],default: [1,2]} } -});*/ +}); + -//, default: [1,2] var PUser = mongoose.model('PowerUsers', userSchema); -//var GeoJSON = mongoose.model('GeoJSON', GeoSchema); +GeoJSON = mongoose.model('GeoJSON', GeoSchema); // Clear out old data @@ -61,11 +61,10 @@ var bursa = new PUser ({ Longitude: 29.063448 } }); -/* var GeoBursa = new GeoJSON ({ location:{ coordinates: { type: [ -73.97, 40.77 ]}} -});*/ +}); // Saving it to the database. From ef1f5e5b01bfae410129a52cd8af00982b9547bd Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 07:49:18 +0200 Subject: [PATCH 55/72] 12 --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 4d0dd50..96923a9 100644 --- a/app.js +++ b/app.js @@ -152,4 +152,4 @@ var html3 = ' documents. '; var html4 = '

Queried (name.last = "Dan", plaka < 93)

 ';
 var html5 = '
'; var html6 = ' documents. '; -var html7 = 'Smiley face '; +var html7 = ' '; From 60673564618bbc87f598c6ed31d5cb39ac22ccd0 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 08:02:30 +0200 Subject: [PATCH 56/72] =?UTF-8?q?=C3=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app.js b/app.js index 96923a9..b788032 100644 --- a/app.js +++ b/app.js @@ -114,11 +114,8 @@ function createWebpage (req, res) { if (!err) { res.write(html1 + JSON.stringify(result, undefined, 3) + html2 + result.length + html3); - - - var query = PUser.find({'name.last': 'Dan'}); - query.where('plaka').lt(93); + 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); From 17e8efc32e748ae721542ec661eeb99a4778b6f4 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 08:30:18 +0200 Subject: [PATCH 57/72] post --- public/index.html | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/public/index.html b/public/index.html index 8c19fe9..ac0d046 100644 --- a/public/index.html +++ b/public/index.html @@ -79,18 +79,38 @@

Yedir'e Hosgeldiniz.

+ From 27a592b6d111b33040e3248d1e95c62575646f70 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 08:31:09 +0200 Subject: [PATCH 58/72] ek --- public/angularr.js | 4 ++-- public/message.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 public/message.js diff --git a/public/angularr.js b/public/angularr.js index 75e95dc..6f22ce6 100644 --- a/public/angularr.js +++ b/public/angularr.js @@ -7,13 +7,13 @@ app.controller('FormCtrl', function ($scope, $http) { $scope.data = { firstname: "default", - emailaddress: "default", + emailaddress: "default",http://posttestserver.com/post.php?dir=jsfiddle attitude: 0, longitude: 0, }; $scope.submitForm = function() { console.log("posting data...."); - $http.post('http://posttestserver.com/post.php?dir=jsfiddle', JSON.stringify(data)).success(function(){/*success callback*/}); + $http.post('', JSON.stringify(data)).success(function(){/*success callback*/}); }; }); \ 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 From 8f053340ff606c9a25cdbdca137fec8aa8c0faff Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 08:51:09 +0200 Subject: [PATCH 59/72] 23 --- app.js | 22 +++++++++++++++++++++- public/index.html | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index b788032..4acb69d 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,25 @@ var http = require ('http'); var mongoose = require ("mongoose"); -//var express = require ("express"); +var express = require ("express"); + +var app = express(); +var bodyParser = require('body-parser') +app.use(bodyParser.json()); +app.use(bodyParser.urlencoded({ + extended: true +})); +app.all('*', function(req, res, next) { + res.header("Access-Control-Allow-Origin", "*"); + res.header("Access-Control-Allow-Headers", "X-Requested-With"); + next(); +}); +app.post('/ReceiveJSON', function(req, res){ + console.log(req.body); + res.send("ok"); +}); +app.listen(5001); +console.log('listening to http://localhost:5001'); + //var socketio = require ("socket.io"); var uristring = @@ -116,6 +135,7 @@ function createWebpage (req, res) { 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); diff --git a/public/index.html b/public/index.html index ac0d046..73e243e 100644 --- a/public/index.html +++ b/public/index.html @@ -90,7 +90,7 @@

Yedir'e Hosgeldiniz.

// Posting data to php file $http({ method : 'POST', - url : 'http://192.168.1.144:5000/', + url : 'http://localhost:5000/', data : $scope.user, //forms user object headers : {'Content-Type': 'application/x-www-form-urlencoded'} }) @@ -103,7 +103,7 @@

Yedir'e Hosgeldiniz.

$scope.errorEmail = data.errors.email; } else { $scope.message = data.message; - console.log(datal) + console.log(data) console.log("else ıcınde") } }); From e1c9780d2f3f2a02e58ea30c8d90b4c02039ec7f Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 10:26:13 +0200 Subject: [PATCH 60/72] 123 --- app.js | 31 +++++++++++++++++++++---------- public/index.html | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index 4acb69d..3fd062d 100644 --- a/app.js +++ b/app.js @@ -1,26 +1,37 @@ var http = require ('http'); var mongoose = require ("mongoose"); var express = require ("express"); - +var bodyParser = require('body-parser'); var app = express(); -var bodyParser = require('body-parser') + +app.use(express.static('public')); + app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); -app.all('*', function(req, res, next) { + +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('/ReceiveJSON', function(req, res){ - console.log(req.body); - res.send("ok"); + +app.post('/ali', function(req, res){ + console.log("yeyeyyeyeyeyeyeyey") + console.log(); + res.send("ok ali"); }); + +app.get('/umit', function(request, response) { + console.log(response.user.latitude); +}); + + app.listen(5001); -console.log('listening to http://localhost:5001'); -//var socketio = require ("socket.io"); + var uristring = process.env.MONGOLAB_URI || @@ -59,7 +70,7 @@ var GeoSchema = new mongoose.Schema({ var PUser = mongoose.model('PowerUsers', userSchema); -GeoJSON = mongoose.model('GeoJSON', GeoSchema); +GeoJSON = mongoose.model('GeoJSON', GeoSchema); // Clear out old data @@ -124,6 +135,7 @@ var found = ['DB Connection not yet established. Try again later. Check the co http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); createWebpage(req, res); + }).listen(theport); @@ -152,7 +164,6 @@ function createWebpage (req, res) { // 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'); // The rudimentary HTML content in three pieces. diff --git a/public/index.html b/public/index.html index 73e243e..1641190 100644 --- a/public/index.html +++ b/public/index.html @@ -103,7 +103,7 @@

Yedir'e Hosgeldiniz.

$scope.errorEmail = data.errors.email; } else { $scope.message = data.message; - console.log(data) + //console.log(data) console.log("else ıcınde") } }); From c8bc8ffaffecbf070e94b5c9a619bd68d17f5817 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 10:28:14 +0200 Subject: [PATCH 61/72] ASD --- app.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.js b/app.js index 3fd062d..82d7cdd 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,8 @@ var http = require ('http'); var mongoose = require ("mongoose"); var express = require ("express"); +/* + var bodyParser = require('body-parser'); var app = express(); @@ -31,6 +33,7 @@ app.get('/umit', function(request, response) { app.listen(5001); +*/ var uristring = From 16f7825e57c1438ce2ec98e91f776cde9f502981 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 10:49:43 +0200 Subject: [PATCH 62/72] geolocation --- public/index.html | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index ac0d046..d499b0b 100644 --- a/public/index.html +++ b/public/index.html @@ -40,6 +40,12 @@

Yedir'e Hosgeldiniz.

+ + + + +

+
@@ -90,7 +96,7 @@

Yedir'e Hosgeldiniz.

// Posting data to php file $http({ method : 'POST', - url : 'http://192.168.1.144:5000/', + url : 'http://posttestserver.com/post.php?dir=jsfiddle', data : $scope.user, //forms user object headers : {'Content-Type': 'application/x-www-form-urlencoded'} }) @@ -103,14 +109,40 @@

Yedir'e Hosgeldiniz.

$scope.errorEmail = data.errors.email; } else { $scope.message = data.message; - console.log(datal) + console.log(data); console.log("else ıcınde") } }); }; + + $scope.getLocation = function() { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(showPosition); + } else { + x.innerHTML = "Geolocation is not supported by this browser."; + } + + }; }); + var x = document.getElementById("demo"); + function getLocation() { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(showPosition); + } else { + x.innerHTML = "Geolocation is not supported by this browser."; + } + } + + function showPosition(position) { + x.innerHTML = "Latitude: " + position.coords.latitude + + "
Longitude: " + position.coords.longitude; + } + + + + From 01cf023a75fecf0f61577c505fbb6657c074e931 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 10:55:19 +0200 Subject: [PATCH 63/72] jjj --- .idea/jsLibraryMappings.xml | 6 ------ public/index.html | 10 ++-------- 2 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 .idea/jsLibraryMappings.xml diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index dfb0ed4..0000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/public/index.html b/public/index.html index fd7ba37..5d3ab25 100644 --- a/public/index.html +++ b/public/index.html @@ -96,11 +96,7 @@

Yedir'e Hosgeldiniz.

// Posting data to php file $http({ method : 'POST', -<<<<<<< HEAD url : 'http://posttestserver.com/post.php?dir=jsfiddle', -======= - url : 'http://localhost:5000/', ->>>>>>> origin/master data : $scope.user, //forms user object headers : {'Content-Type': 'application/x-www-form-urlencoded'} }) @@ -113,11 +109,9 @@

Yedir'e Hosgeldiniz.

$scope.errorEmail = data.errors.email; } else { $scope.message = data.message; -<<<<<<< HEAD + console.log(data); -======= - //console.log(data) ->>>>>>> origin/master + console.log("else ıcınde") } }); From 52020a471604db25bf1a163a817a012b997d2ff0 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 10:58:16 +0200 Subject: [PATCH 64/72] gggg --- public/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/index.html b/public/index.html index 5d3ab25..61059b8 100644 --- a/public/index.html +++ b/public/index.html @@ -135,6 +135,8 @@

Yedir'e Hosgeldiniz.

} } + + function showPosition(position) { x.innerHTML = "Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude; From ac3b9b5b01da06c9099d5729eb61f256005511e8 Mon Sep 17 00:00:00 2001 From: Ozge TAN Date: Sun, 21 Feb 2016 11:26:35 +0200 Subject: [PATCH 65/72] tek buton --- public/index.html | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/public/index.html b/public/index.html index 61059b8..2bda539 100644 --- a/public/index.html +++ b/public/index.html @@ -25,28 +25,19 @@

Yedir'e Hosgeldiniz.

+
- -
- -
-
-
- +
- +
- - - -

- +
@@ -116,15 +107,6 @@

Yedir'e Hosgeldiniz.

} }); }; - - $scope.getLocation = function() { - if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition(showPosition); - } else { - x.innerHTML = "Geolocation is not supported by this browser."; - } - - }; }); var x = document.getElementById("demo"); function getLocation() { @@ -135,8 +117,6 @@

Yedir'e Hosgeldiniz.

} } - - function showPosition(position) { x.innerHTML = "Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude; From 1f24a34f16567385df38a9d85e8e92dd7ac9c0ad Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 11:27:36 +0200 Subject: [PATCH 66/72] 1 --- app.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 82d7cdd..8011ffb 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,7 @@ var http = require ('http'); var mongoose = require ("mongoose"); var express = require ("express"); -/* + var bodyParser = require('body-parser'); var app = express(); @@ -21,8 +21,6 @@ app.use('/veli', function(req, res, next) { }); app.post('/ali', function(req, res){ - console.log("yeyeyyeyeyeyeyeyey") - console.log(); res.send("ok ali"); }); @@ -33,7 +31,7 @@ app.get('/umit', function(request, response) { app.listen(5001); -*/ + var uristring = From 4b8e350f5f6064a48adaca34ddddda579f315e9c Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 11:36:50 +0200 Subject: [PATCH 67/72] son --- public/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 2bda539..a5cbd07 100644 --- a/public/index.html +++ b/public/index.html @@ -8,10 +8,10 @@ - +
-
+

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.

From d36139421f0409e936b24f0bb5ca065c3ee30547 Mon Sep 17 00:00:00 2001 From: Umit Arslan Date: Sun, 21 Feb 2016 11:39:49 +0200 Subject: [PATCH 68/72] son --- README.md | 6 ++---- public/index.html | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 25f2ce3..62c0f01 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ +http://localhost:5001/ portundan client -2. `heroku create` -3. `heroku addons:add mongolab` -3. `git push heroku master` -4. `heroku open` +5000 server portu \ No newline at end of file diff --git a/public/index.html b/public/index.html index a5cbd07..53e5597 100644 --- a/public/index.html +++ b/public/index.html @@ -76,9 +76,9 @@

Yedir'e Hosgeldiniz.