Permalink
Browse files

didn't fix it :(

  • Loading branch information...
1 parent 35426a6 commit 850b343dd3a5e5998ec6632021d295ab0d594144 @rayui committed Feb 3, 2012
Showing with 25 additions and 21 deletions.
  1. +18 −20 js/modules/models.js
  2. +6 −0 js/modules/sessions.js
  3. +1 −1 templates/index.jade
View
@@ -18,34 +18,32 @@ models.Config = {
this.end(data);
}
};
-
+
models.User = {
+ data:{
+ id:"",
+ name:""
+ },
schema: schemas.User,
get: function(body) {
- var that = this,
- data = {
- id:2,
- name:'ray'
- };
-
- this.query({}, [], function(_data) {
+ var that = this;
+
+ /*this.query({}, [], function(_data) {
console.log(_data);
- that.end(data);
- });
+ that.end(that.data);
+ });*/
+
+ this.end(this.data);
},
post:function(body) {
- var data = {
- id:2,
- name:'ray'
- };
- this.end(data);
+ this.data.id = body.id;
+ this.data.name = body.name;
+ this.end(this.data);
},
put:function(body) {
- var data = {
- id:2,
- name:'ray'
- };
- this.end(data);
+ this.data.id = body.id;
+ this.data.name = body.name;
+ this.end(this.data);
},
delete:function(body) {
this.end({});
View
@@ -41,6 +41,12 @@ Handler.prototype.createSession = function() {
return sessionId;
};
+Handler.prototype.destroySession = function(sessionId) {
+ //destroys session
+ delete sessions[sessionId];
+};
+
+
Handler.prototype.getSession = function(sessionId) {
//if session with key md5 exists return it
//else return undefined
View
@@ -10,7 +10,7 @@ body
label(for="name") Name
input#name(type="text", name="name")
input(type="submit")
- #model
+ #model #{id}: #{name}
#errors
a(href="/config") View the config

0 comments on commit 850b343

Please sign in to comment.