@@ -45,45 +45,20 @@ module.exports = function(app) {
4545 } ) ;
4646
4747 appRouter . get ( '/users/:id' , function ( req , res ) {
48+ if ( req . params . id === 'admin' ) {
49+ res . send ( { user : { id : 1 , name : 'testuser' , lat : 50 , long : 40 , zoom : 3 } } ) ;
50+ }
4851 res . send ( { user : { id : req . params . id , name : 'testuser' , lat : 50 , long : 40 , zoom : 3 } } ) ;
4952 } ) ;
5053
51- appRouter . put ( '/users/:id' , function ( req , res ) {
52- res . send ( { user : { id : req . params . id , name : req . body . user . name , lat : req . body . user . lat , long : req . body . user . long , zoom : req . body . user . zoom } } ) ;
53- } ) ;
54-
55-
56- var user_category = { id : 1 , name : 'test' , expired_at : new Date ( ) , zip_code : '123456' , description : chance . paragraph ( { sentences : 10 } ) , is_created : true , email : 'foo@bar.com' , color : '#AFAFAF' } ;
57- appRouter . get ( '/user_categories' , function ( req , res ) {
58- res . send ( { user_categories : [ user_category ] } ) ;
59- } ) ;
60- appRouter . delete ( '/user_categories/:id' , function ( req , res ) {
61- res . send ( { } ) ;
62- } ) ;
63-
64- appRouter . get ( '/user_categories/:id' , function ( req , res ) {
65- res . send ( { user_category : user_category } ) ;
66- } ) ;
67-
68- appRouter . put ( '/user_categories/:id' , function ( req , res ) {
69- res . send ( { user_category : { id : req . params . id , name : req . body . user_category . name , expired_at : req . body . user_category . expired_at , zip_code : req . body . user_category . zip_code , description : req . body . user_category . description , is_created : req . body . user_category . is_created , email : req . body . user_category . email , color : req . body . user_category . color } } ) ;
54+ appRouter . post ( '/users/sign_in' , function ( req , res ) {
55+ res . send ( { user_token : 'token123456' , user_email : 'test@example.com' } ) ;
7056 } ) ;
7157
72- appRouter . get ( '/catalogues' , function ( req , res ) {
73- var catalogues = [ { id : 1 , name : 'Tree #1' , parent_id : null , catalogue_ids : [ 2 , 3 ] } ,
74- { id : 2 , name : 'Tree #2' , parent_id : 1 , catalogue_ids : [ 4 ] } ,
75- { id : 3 , name : 'Tree #3' , parent_id : 1 , catalogue_ids : [ 5 ] } ,
76- { id : 4 , name : 'Tree #4' , parent_id : 2 , catalogue_ids : [ ] } ,
77- { id : 5 , name : 'Tree #5' , parent_id : 3 , catalogue_ids : [ ] }
78- ] ;
79- res . send ( { catalogues : catalogues } ) ;
58+ appRouter . put ( '/users/:id' , function ( req , res ) {
59+ res . send ( { user : { id : req . params . id , name : req . body . user . name , lat : req . body . user . lat , long : req . body . user . long , zoom : req . body . user . zoom } } ) ;
8060 } ) ;
8161
82-
83- appRouter . post ( '/catalogues' , function ( req , res ) {
84- res . send ( { } ) ;
85- } ) ;
86-
8762 appRouter . post ( '/avatars' , function ( req , res ) {
8863// req.on('data', function(chunk){ console.log(chunk)});
8964 res . send ( { avatar : { id : 1 , thumb_url : 'http://media-cache-ak0.pinimg.com/236x/0c/e6/7f/0ce67fa7c94da77ab90877e65f3fda87.jpg' , url : 'http://www.londra.us/Bristol_Castle.jpg' } } ) ;
0 commit comments