Permalink
Browse files

Added example to-do app, linked to the features in the generated app,…

… removed links to tutorial and docs.
  • Loading branch information...
1 parent b588496 commit c1495f3afc983465141fc030a4fb28e67d6b89f3 Techwraith committed Feb 8, 2012
Showing with 10,927 additions and 42 deletions.
  1. +25 −0 examples/todo_app/app/controllers/application.js
  2. +30 −0 examples/todo_app/app/controllers/main.js
  3. +55 −0 examples/todo_app/app/controllers/todos.js
  4. +21 −0 examples/todo_app/app/models/todo.js
  5. +51 −0 examples/todo_app/app/views/layouts/application.html.ejs
  6. +6 −0 examples/todo_app/app/views/main/index.html.ejs
  7. +13 −0 examples/todo_app/app/views/todos/add.html.ejs
  8. +8 −0 examples/todo_app/app/views/todos/edit.html.ejs
  9. +13 −0 examples/todo_app/app/views/todos/index.html.ejs
  10. +27 −0 examples/todo_app/app/views/todos/show.html.ejs
  11. +11 −0 examples/todo_app/config/environment.js
  12. +12 −0 examples/todo_app/config/init.js
  13. +32 −0 examples/todo_app/config/production.js
  14. +37 −0 examples/todo_app/config/router.js
  15. +39 −0 examples/todo_app/lib/model_adapters/todo.js
  16. 0 examples/todo_app/log/access.1328686763715.log
  17. +32 −0 examples/todo_app/log/access.1328687335860.log
  18. 0 examples/todo_app/log/access.1328687360995.log
  19. 0 examples/todo_app/log/access.1328687390729.log
  20. +25 −0 examples/todo_app/log/access.1328687486372.log
  21. 0 examples/todo_app/log/access.1328687524596.log
  22. 0 examples/todo_app/log/access.1328687929865.log
  23. 0 examples/todo_app/log/access.1328687959693.log
  24. +8 −0 examples/todo_app/log/access.1328688032381.log
  25. +33 −0 examples/todo_app/log/access.1328688125966.log
  26. +49 −0 examples/todo_app/log/access.1328688221987.log
  27. +17 −0 examples/todo_app/log/access.1328688332450.log
  28. +33 −0 examples/todo_app/log/access.1328688404249.log
  29. +25 −0 examples/todo_app/log/access.1328688470189.log
  30. +35 −0 examples/todo_app/log/access.1328688577729.log
  31. +17 −0 examples/todo_app/log/access.1328688631112.log
  32. +17 −0 examples/todo_app/log/access.1328688737369.log
  33. +17 −0 examples/todo_app/log/access.1328688791242.log
  34. +8 −0 examples/todo_app/log/access.1328688878598.log
  35. +17 −0 examples/todo_app/log/access.1328688935967.log
  36. +25 −0 examples/todo_app/log/access.1328688986932.log
  37. +17 −0 examples/todo_app/log/access.1328689007434.log
  38. +17 −0 examples/todo_app/log/access.1328689257872.log
  39. +17 −0 examples/todo_app/log/access.1328689288146.log
  40. +16 −0 examples/todo_app/log/access.1328689307688.log
  41. +17 −0 examples/todo_app/log/access.1328689389330.log
  42. +17 −0 examples/todo_app/log/access.1328689452498.log
  43. 0 examples/todo_app/log/access.1328689560511.log
  44. +67 −0 examples/todo_app/log/access.1328690120385.log
  45. +65 −0 examples/todo_app/log/access.1328690358284.log
  46. +65 −0 examples/todo_app/log/access.1328690456131.log
  47. +41 −0 examples/todo_app/log/access.1328690499899.log
  48. +58 −0 examples/todo_app/log/access.1328690603521.log
  49. +49 −0 examples/todo_app/log/access.1328690671649.log
  50. +26 −0 examples/todo_app/log/access.1328690778680.log
  51. +84 −0 examples/todo_app/log/access.1328690913469.log
  52. +42 −0 examples/todo_app/log/access.1328691003003.log
  53. +33 −0 examples/todo_app/log/access.1328691147502.log
  54. +50 −0 examples/todo_app/log/access.1328691681394.log
  55. +42 −0 examples/todo_app/log/access.1328691751925.log
  56. +129 −0 examples/todo_app/log/access.1328691918441.log
  57. +115 −0 examples/todo_app/log/access.1328692226835.log
  58. 0 examples/todo_app/log/access.1328692256967.log
  59. +76 −0 examples/todo_app/log/access.1328692608693.log
  60. +59 −0 examples/todo_app/log/access.1328692897598.log
  61. +16 −0 examples/todo_app/log/access.1328692941286.log
  62. +34 −0 examples/todo_app/log/access.1328693100308.log
  63. +44 −0 examples/todo_app/log/access.1328693253687.log
  64. +168 −0 examples/todo_app/log/access.1328693536113.log
  65. +1 −0 examples/todo_app/log/access.1328693558912.log
  66. +43 −0 examples/todo_app/log/access.1328693580018.log
  67. +102 −0 examples/todo_app/log/access.1328694296654.log
  68. +16 −0 examples/todo_app/log/access.1328694374869.log
  69. 0 examples/todo_app/log/access.1328694387333.log
  70. +16 −0 examples/todo_app/log/access.1328694416198.log
  71. +25 −0 examples/todo_app/log/access.1328694631691.log
  72. +112 −0 examples/todo_app/log/access.1328694822714.log
  73. 0 examples/todo_app/log/access.log
  74. 0 examples/todo_app/log/stderr.1328686763715.log
  75. +1 −0 examples/todo_app/log/stderr.1328687335860.log
  76. +1 −0 examples/todo_app/log/stderr.1328687360995.log
  77. +1 −0 examples/todo_app/log/stderr.1328687390729.log
  78. +2 −0 examples/todo_app/log/stderr.1328687486372.log
  79. +1 −0 examples/todo_app/log/stderr.1328687524596.log
  80. 0 examples/todo_app/log/stderr.1328687929865.log
  81. 0 examples/todo_app/log/stderr.1328687959693.log
  82. +1 −0 examples/todo_app/log/stderr.1328688032381.log
  83. 0 examples/todo_app/log/stderr.1328688125966.log
  84. +2 −0 examples/todo_app/log/stderr.1328688221987.log
  85. +1 −0 examples/todo_app/log/stderr.1328688332450.log
  86. 0 examples/todo_app/log/stderr.1328688404249.log
  87. 0 examples/todo_app/log/stderr.1328688470189.log
  88. 0 examples/todo_app/log/stderr.1328688577729.log
  89. 0 examples/todo_app/log/stderr.1328688631112.log
  90. 0 examples/todo_app/log/stderr.1328688737369.log
  91. 0 examples/todo_app/log/stderr.1328688791242.log
  92. +1 −0 examples/todo_app/log/stderr.1328688878598.log
  93. +1 −0 examples/todo_app/log/stderr.1328688935967.log
  94. 0 examples/todo_app/log/stderr.1328688986932.log
  95. 0 examples/todo_app/log/stderr.1328689007434.log
  96. 0 examples/todo_app/log/stderr.1328689257872.log
  97. 0 examples/todo_app/log/stderr.1328689288146.log
  98. 0 examples/todo_app/log/stderr.1328689307688.log
  99. 0 examples/todo_app/log/stderr.1328689389330.log
  100. 0 examples/todo_app/log/stderr.1328689452498.log
  101. +1 −0 examples/todo_app/log/stderr.1328689560511.log
  102. 0 examples/todo_app/log/stderr.1328690120385.log
  103. 0 examples/todo_app/log/stderr.1328690358284.log
  104. 0 examples/todo_app/log/stderr.1328690456131.log
  105. 0 examples/todo_app/log/stderr.1328690499899.log
  106. 0 examples/todo_app/log/stderr.1328690603521.log
  107. 0 examples/todo_app/log/stderr.1328690671649.log
  108. 0 examples/todo_app/log/stderr.1328690778680.log
  109. 0 examples/todo_app/log/stderr.1328690913469.log
  110. 0 examples/todo_app/log/stderr.1328691003003.log
  111. +1 −0 examples/todo_app/log/stderr.1328691147502.log
  112. 0 examples/todo_app/log/stderr.1328691681394.log
  113. +1 −0 examples/todo_app/log/stderr.1328691751925.log
  114. 0 examples/todo_app/log/stderr.1328691918441.log
  115. 0 examples/todo_app/log/stderr.1328692226835.log
  116. 0 examples/todo_app/log/stderr.1328692256967.log
  117. 0 examples/todo_app/log/stderr.1328692608693.log
  118. 0 examples/todo_app/log/stderr.1328692897598.log
  119. +1 −0 examples/todo_app/log/stderr.1328692941286.log
  120. 0 examples/todo_app/log/stderr.1328693100308.log
  121. 0 examples/todo_app/log/stderr.1328693253687.log
  122. +1 −0 examples/todo_app/log/stderr.1328693536113.log
  123. +1 −0 examples/todo_app/log/stderr.1328693558912.log
  124. 0 examples/todo_app/log/stderr.1328693580018.log
  125. +2 −0 examples/todo_app/log/stderr.1328694296654.log
  126. +1 −0 examples/todo_app/log/stderr.1328694374869.log
  127. +1 −0 examples/todo_app/log/stderr.1328694387333.log
  128. +1 −0 examples/todo_app/log/stderr.1328694416198.log
  129. 0 examples/todo_app/log/stderr.1328694631691.log
  130. 0 examples/todo_app/log/stderr.1328694822714.log
  131. 0 examples/todo_app/log/stderr.log
  132. +50 −0 examples/todo_app/log/stdout.1328686763715.log
  133. +28 −0 examples/todo_app/log/stdout.1328687335860.log
  134. +23 −0 examples/todo_app/log/stdout.1328687360995.log
  135. +23 −0 examples/todo_app/log/stdout.1328687390729.log
  136. +36 −0 examples/todo_app/log/stdout.1328687486372.log
  137. +30 −0 examples/todo_app/log/stdout.1328687524596.log
  138. +38 −0 examples/todo_app/log/stdout.1328687929865.log
  139. +26 −0 examples/todo_app/log/stdout.1328687959693.log
  140. +34 −0 examples/todo_app/log/stdout.1328688032381.log
  141. +28 −0 examples/todo_app/log/stdout.1328688125966.log
  142. +36 −0 examples/todo_app/log/stdout.1328688221987.log
  143. +28 −0 examples/todo_app/log/stdout.1328688332450.log
  144. +32 −0 examples/todo_app/log/stdout.1328688404249.log
  145. +32 −0 examples/todo_app/log/stdout.1328688470189.log
  146. +28 −0 examples/todo_app/log/stdout.1328688577729.log
  147. +32 −0 examples/todo_app/log/stdout.1328688631112.log
  148. +28 −0 examples/todo_app/log/stdout.1328688737369.log
  149. +28 −0 examples/todo_app/log/stdout.1328688791242.log
  150. +28 −0 examples/todo_app/log/stdout.1328688878598.log
  151. +34 −0 examples/todo_app/log/stdout.1328688935967.log
  152. +28 −0 examples/todo_app/log/stdout.1328688986932.log
  153. +28 −0 examples/todo_app/log/stdout.1328689007434.log
  154. +28 −0 examples/todo_app/log/stdout.1328689257872.log
  155. +28 −0 examples/todo_app/log/stdout.1328689288146.log
  156. +26 −0 examples/todo_app/log/stdout.1328689307688.log
  157. +32 −0 examples/todo_app/log/stdout.1328689389330.log
  158. +26 −0 examples/todo_app/log/stdout.1328689452498.log
  159. +26 −0 examples/todo_app/log/stdout.1328689560511.log
  160. +32 −0 examples/todo_app/log/stdout.1328690120385.log
  161. +32 −0 examples/todo_app/log/stdout.1328690358284.log
  162. +28 −0 examples/todo_app/log/stdout.1328690456131.log
  163. +28 −0 examples/todo_app/log/stdout.1328690499899.log
  164. +28 −0 examples/todo_app/log/stdout.1328690603521.log
  165. +28 −0 examples/todo_app/log/stdout.1328690671649.log
  166. +28 −0 examples/todo_app/log/stdout.1328690778680.log
  167. +30 −0 examples/todo_app/log/stdout.1328690913469.log
  168. +30 −0 examples/todo_app/log/stdout.1328691003003.log
  169. +30 −0 examples/todo_app/log/stdout.1328691147502.log
  170. +30 −0 examples/todo_app/log/stdout.1328691681394.log
  171. +28 −0 examples/todo_app/log/stdout.1328691751925.log
  172. +32 −0 examples/todo_app/log/stdout.1328691918441.log
  173. +28 −0 examples/todo_app/log/stdout.1328692226835.log
  174. +31 −0 examples/todo_app/log/stdout.1328692256967.log
  175. +39 −0 examples/todo_app/log/stdout.1328692608693.log
  176. +42 −0 examples/todo_app/log/stdout.1328692897598.log
  177. +33 −0 examples/todo_app/log/stdout.1328692941286.log
  178. +33 −0 examples/todo_app/log/stdout.1328693100308.log
  179. +38 −0 examples/todo_app/log/stdout.1328693253687.log
  180. +44 −0 examples/todo_app/log/stdout.1328693536113.log
  181. +31 −0 examples/todo_app/log/stdout.1328693558912.log
  182. +33 −0 examples/todo_app/log/stdout.1328693580018.log
  183. +44 −0 examples/todo_app/log/stdout.1328694296654.log
  184. +33 −0 examples/todo_app/log/stdout.1328694374869.log
  185. +32 −0 examples/todo_app/log/stdout.1328694387333.log
  186. +33 −0 examples/todo_app/log/stdout.1328694416198.log
  187. +33 −0 examples/todo_app/log/stdout.1328694631691.log
  188. +39 −0 examples/todo_app/log/stdout.1328694822714.log
  189. +31 −0 examples/todo_app/log/stdout.log
  190. +3,363 −0 examples/todo_app/public/css/bootstrap.css
  191. +610 −0 examples/todo_app/public/css/bootstrap.min.css
  192. +567 −0 examples/todo_app/public/css/bootstrap.responsive.css
  193. +3 −0 examples/todo_app/public/css/bootstrap.responsive.min.css
  194. +26 −0 examples/todo_app/public/css/style.css
  195. BIN examples/todo_app/public/favicon.ico
  196. BIN examples/todo_app/public/img/glyphicons-halflings-white.png
  197. BIN examples/todo_app/public/img/glyphicons-halflings.png
  198. BIN examples/todo_app/public/img/whitey.png
  199. +1,722 −0 examples/todo_app/public/js/bootstrap.js
  200. +1 −0 examples/todo_app/public/js/bootstrap.min.js
  201. +4 −0 examples/todo_app/public/js/jquery.min.js
  202. +229 −29 site/features.html
  203. +7 −7 site/index.html
  204. +128 −4 site/tutorial.html
  205. +2 −2 templates/base/views/main/index.html.ejs
@@ -0,0 +1,25 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var Application = function () {
+};
+
+exports.Application = Application;
+
+
+
@@ -0,0 +1,30 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var Main = function () {
+ this.index = function (req, resp, params) {
+ this.respond(params, {
+ format: 'html'
+ , template: 'app/views/main/index'
+ });
+ };
+};
+
+exports.Main = Main;
+
+
@@ -0,0 +1,55 @@
+
+var Todos = function () {
+ this.respondsWith = ['html', 'json', 'js', 'txt'];
+
+ this.index = function (req, resp, params) {
+ this.respond({params: params, todos: geddy.todos});
+ };
+
+ this.add = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.create = function (req, resp, params) {
+ var todo = geddy.model.Todo.create({title: params.title, id: geddy.string.uuid(10), status: 'open'});
+ if (todo.isValid()) {
+ todo.save();
+ this.redirect({controller: this.name});
+ } else {
+ this.redirect({controller: this.name, action: 'add?error=true'});
+ }
+ };
+
+ this.show = function (req, resp, params) {
+ var self = this;
+ geddy.model.adapter.Todo.load(params.id, function(todo){
+ console.log(todo);
+ self.respond({params: params, todo: todo});
+ });
+ };
+
+ this.edit = function (req, resp, params) {
+ var self = this;
+ geddy.model.Todo.load(params.id, function(todo){
+ self.respond({params: params, todo: todo});
+ });
+ };
+
+ this.update = function (req, resp, params) {
+ var self = this;
+ geddy.model.adapter.Todo.load(params.id, function(todo){
+ todo.status = params.status;
+ todo.save();
+ self.redirect({controller: this.name, id: params.id});
+ });
+ };
+
+ this.remove = function (req, resp, params) {
+ geddy.model.adapter.Todo.removeById(params.id);
+ this.respond({params: params});
+ };
+
+};
+
+exports.Todos = Todos;
+
@@ -0,0 +1,21 @@
+
+var Todo = function () {
+ this.property('title', 'string', {required: true});
+ this.property('status', 'string', {required: true, default: 'open'});
+ this.property('id', 'string', {required: true, })
+
+ this.validatesPresent('title');
+ this.validatesLength('title', {min: 5});
+
+ this.validatesWithFunction('status', function (status) {
+ return status == 'open' || status == 'done';
+ });
+
+ this.finish = function() {
+ this.status = 'done';
+ }
+
+};
+
+Todo = geddy.model.register('Todo', Todo);
+
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Geddy App | This app uses Geddy.js</title>
+ <meta name="description" content="">
+ <meta name="author" content="">
+
+ <meta name="viewport" content="width=device-width" />
+
+ <!-- The HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <script type="text/javascript" src="/js/jquery.min.js"></script>
+ <script type="text/javascript" src="/js/bootstrap.min.js"></script>
+
+ <link rel="stylesheet" href="/css/bootstrap.min.css">
+ <link rel="stylesheet" href="/css/style.css">
+ <link rel="stylesheet" href="/css/bootstrap.responsive.min.css">
+
+ <!-- The fav and touch icons -->
+ <link rel="shortcut icon" href="/images/favicon.ico">
+ <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+ </head>
+ <body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="i-bar"><i class="icon-chevron-down icon-white"></i></span>
+ </a>
+ <a class="brand" href="/">Geddy App</a>
+ <div class="nav-collapse">
+ <ul class="nav">
+ <li class="active"><a href="/">Home</a></li>
+ <!--<li><a href="http://geddyjs.org/tutorial.html">Tutorial</a></li>-->
+ <!--<li><a href="http://geddyjs.org/docs.html">Docs</a></li>-->
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+ </div>
+ <div class="container">
+ <%- yield(); %>
+ </div>
+ </body>
+</html>
@@ -0,0 +1,6 @@
+<!-- Lets talk about geddy -->
+<div class="hero-unit geddy-welcome-box">
+ <h1>Hello, World!</h1>
+ <p>You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic.<!--, if not...</p>
+ <p><a href="http://geddyjs.org/tutorial.html" class="btn btn-primary btn-large">Lets get you started »</a></p>-->
+</div>
@@ -0,0 +1,13 @@
+<div class="hero-unit">
+ <h2>Add a ToDo:</h2>
+ <form action="/todos" method="POST">
+ <% if (params.error) {
+ var title = 'title not long enough, must be 5 characters or more.'
+ } else {
+ var title = 'enter title'
+ }
+ %>
+ <input type="text" class="span6" placeholder="<%= title %>" name="title"/>
+ <input type="submit" class="btn btn-primary">
+ </form>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,13 @@
+<div class="hero-unit">
+ <% if (todos.length) { %>
+ <h3>ToDos:</h3>
+ <ul>
+ <% for (var i in todos) { %>
+ <li><a href="/todos/<%= todos[i].id; %>"><%= todos[i].title; %></a> - <%= todos[i].status; %></li>
+ <% } %>
+ </ul>
+ <% } else { %>
+ No ToDos yet
+ <% } %>
+ <a href="/todos/add">Create a new ToDo</a>
+</div>
@@ -0,0 +1,27 @@
+<div class="hero-unit">
+ <a href="/todos">&laquo; back to index</a>
+ <h3><%= todo.title; %></h3>
+ <% if (todo.status == 'open') { %>
+ <form id="finish-todo" action="/todos/update" method="POST">
+ <input type="hidden" name="status" value="done"/>
+ <input type="hidden" name="id" value="<%= todo.id; %>"/>
+ <input type="hidden" name="title" value="<%= todo.title; %>">
+ </form>
+ <a href="#" class="btn" id="finish-btn">Finish</a>
+ <script type="text/javascript">
+ var form = $('#finish-todo');
+ $('#finish-btn').click(function(e){
+ e.preventDefault();
+ $.ajax({
+ type: "PUT",
+ url: form.attr('action'),
+ data: form.serialize()
+ }).done(function( msg ) {
+ $(e.target).replaceWith('<p>This todo is finished!</p>');
+ });
+ })
+ </script>
+ <% } else { %>
+ <p>This todo is finished!</p>
+ <% } %>
+</div>
@@ -0,0 +1,11 @@
+var config = {
+
+ metrics: {
+ port: 4001
+ }
+
+};
+
+module.exports = config;
+
+
@@ -0,0 +1,12 @@
+
+// Add uncaught-exception handler in prod-like environments
+if (geddy.config.environment != 'development') {
+ process.addListener('uncaughtException', function (err) {
+ geddy.log.error(JSON.stringify(err));
+ });
+}
+geddy.model.adapter = {};
+geddy.model.adapter.Todo = require(process.cwd() + '/lib/model_adapters/todo').Todo;
+
+geddy.todos = [];
+
@@ -0,0 +1,32 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var config = {
+ detailedErrors: false
+, hostname: null
+, port: 4000
+, sessions: {
+ store: 'memory'
+ , key: 'sid'
+ , expiry: 14 * 24 * 60 * 60
+ }
+};
+
+module.exports = config;
+
+
@@ -0,0 +1,37 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+
+var router = new geddy.RegExpRouter();
+router.match('/').to({controller: 'Todos', action: 'index'});
+
+// Basic routes
+// router.match('/moving/pictures/:id').to(
+// {controller: 'Moving', action: 'pictures'});
+// router.match('/farewells/:farewelltype/kings/:kingid').to(
+// {controller: 'Farewells', action: 'kings'});
+// Can also match specific HTTP methods only
+// router.match('/xandadu', 'get').to(
+// {controller: 'Xandadu', action: 'specialHandler'});
+//
+// Resource-based routes
+// router.resource('hemispheres');
+
+router.resource('todos');
+exports.router = router;
+
@@ -0,0 +1,39 @@
+var Todo = new (function () {
+
+ var Todo = geddy.model.Todo;
+
+ this.load = function (id, callback) {
+ for (var i in geddy.todos) {
+ if (geddy.todos[i].id == id) {
+ callback(geddy.todos[i]);
+ return;
+ }
+ }
+ callback({});
+ };
+
+ this.remove = function (id) {
+ for (var i in geddy.todos) {
+ if (geddy.todos[i].id == id) {
+ geddy.todos.splice(i,1);
+ }
+ }
+ }
+
+ this.save = function (todo, callback) {
+ for (var i in geddy.todos) {
+
+ // if it's already there, save it
+ if (geddy.todos[i].id == todo.id) {
+ geddy.todos[i] = todo;
+ return
+ }
+
+ }
+ todo.saved = true;
+ geddy.todos.push(todo);
+ }
+
+})();
+
+exports.Todo = Todo;
Oops, something went wrong.

0 comments on commit c1495f3

Please sign in to comment.