diff --git a/main.js b/main.js index e6050e8..f8efea9 100644 --- a/main.js +++ b/main.js @@ -18,6 +18,7 @@ const boardProcessRouter = require('./routes/boardProcessRouter.js'); const boardUpdateProcessRouter = require('./routes/boardUpdateProcessRouter.js'); const boardDeleteProcessRouter = require('./routes/boardDeleteProcessRouter.js'); const myboardRouter = require('./routes/myboardRouter.js'); +const mbtiRouter = require('./routes/mbtiRouter.js'); const env = require('./config/env.js'); const port = env.port; @@ -73,6 +74,8 @@ app.use('/likes', likeRouter); app.use('/myboard', myboardRouter); +app.use('/mbti', mbtiRouter); + app.get('/logout', function(req, res) { req.logout(); req.session.save(() => { diff --git a/routes/mbtiRouter.js b/routes/mbtiRouter.js new file mode 100644 index 0000000..20ff538 --- /dev/null +++ b/routes/mbtiRouter.js @@ -0,0 +1,26 @@ +const express = require('express'); +const router = express.Router(); +const mbti_start = require('../template/mbti_start.js'); +const mbti_test = require('../template/mbti_test.js'); +const mbti_result = require('../template/mbti_result.js'); +// var db = require('../config/db'); // db.js 폴더 경로 + + +router.get('/', function(request, response){ + + const body = mbti_start.HOME(); + response.send(mbti_start.HTML(body)); +}); + +router.get('/test', function(request, response){ + const body = mbti_test.HOME(); + response.send(mbti_test.HTML(body)); +}); + +router.get('/result', function(request, response){ + const body = mbti_result.HOME(); + response.send(mbti_result.HTML(body)); +}); + + +module.exports = router; \ No newline at end of file diff --git a/template/mbti_result.js b/template/mbti_result.js new file mode 100644 index 0000000..4a093f5 --- /dev/null +++ b/template/mbti_result.js @@ -0,0 +1,109 @@ +module.exports = { + HTML: function(body) { + const head = this.HEAD(); + const tail = this.TAIL(); + return ` + ${head} + ${body} + ${tail} + ` + }, + HOME: function( ) { + return ` + + +
+Q1. 술집에서 멍하니 있는 당신의 머리속은?