var express = require('express');
var router = express.Router();
var Answer = require(config.root.MODEL_ROOT).answer;
var scoreMod = require(config.root.MODULE_ROOT).score;

function saveAnswer(ua, answers) {
	var answer = new Answer();
	answer.ua = ua;
	answer.gender = answers.a1;
	answer.age = answers.a2;
	answer.married = answers.a3;
	answer.atHome = answers.a4;
	answer.needs = answers.a5;
	answer.interiorRatio = answers.a6;
	answer.color = answers.a7;
	answer.culture = answers.a8;
	answer.save(function(err) {
		logger.info("Answer is saved!");
		if (err) {
			logger.error("DB error: saving Answer!");
		}
	});
}
router.post("/", function(req, res, next) {
	// Calculating score
	var score = new scoreMod();
	// calculate
	score.calculate(req.body);
	var myscore = score.getScore();
	var result = score.getResult();
	
	if (!myscore) {
		res.status(400).send("Wrong answer type");
	} else {
		// TODO: result first와 second 값으로 결과 페이지 구성하기!
		// DB: save answer
		// TODO: uncomment to save answer to DB
		//saveAnswer(req.headers['user-agent'], req.body);
		
		res.send({
			url: "/result/" + result.first
		});
	}	
});

module.exports = router;

@@ -902,119 +902,26 @@
 %09// 
-TODO: result first%EC%99%80 second %EA%B0%92%EC%9C%BC%EB%A1%9C %EA%B2%B0%EA%B3%BC %ED%8E%98%EC%9D%B4%EC%A7%80 %EA%B5%AC%EC%84%B1%ED%95%98%EA%B8%B0!%0A%09%09// DB: save answer%0A%09%09// TODO: uncomment to save answer to DB%0A%09%09//
+DB: save answer%0A%09%09
 save

Save answer but error occured