/**
 * 
 */
package net.wyun.wcrs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import net.wyun.wcrs.model.User;
import net.wyun.wcrs.model.UserRepository;

/**
 * @author Xuecheng
 *
 */
@RequestMapping("/secure")
@RestController
public class UserController {
	
	@Autowired
	UserRepository userRepo;
	
	@RequestMapping(value= "/user", method=RequestMethod.POST)
	User saveUser(@RequestBody User user){
		
		return userRepo.save(user);
	}

}

@@ -56,57 +56,174 @@
 rg.s
-pringframework.beans.factory.annotation.Autowired
+lf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.web.bind.annotation.CrossOrigin
 ;%0Aim
@@ -638,16 +638,29 @@
 %0A *%0A */%0A
+@CrossOrigin%0A
 @Request
@@ -726,16 +726,103 @@
 ler %7B%0A%09%0A
+%09private static final Logger logger = LoggerFactory.getLogger(UserController.class);%0A%09%0A
 %09@Autowi
@@ -990,10 +990,323 @@
 r);%0A
-
 %09%7D
+%0A%09%0A%09@RequestMapping(value= %22/user/%7Boid%7D%22, method=RequestMethod.GET)%0A%09User getUser(@PathVariable(%22oid%22) String openId)%7B%0A%09%09return userRepo.findByOpenID(openId);%0A%09%7D%0A%09%0A%09@RequestMapping(value= %22/bonus/%7Boid%7D%22, method=RequestMethod.GET)%0A%09String getUserBonus(@PathVariable(%22oid%22) String openId)%7B%0A%09%09return %22$25.88%22;%0A%09%7D%0A%09%0A%09
 %0A%0A%7D%0A

enable crossorigin. add rest to get user info. bonus info.