Skip to content
Permalink
Browse files
showing examples in class
  • Loading branch information
reisborw committed Oct 14, 2019
1 parent 8a707f1 commit 6e4a85a9c201f2cc08388c3347d0d74a16aa387f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
@@ -0,0 +1,12 @@
'use strict';

const Question = require('../models/question');

module.exports = class QuestionController {

static showExample() {
let question = new Question();
console.log(question.example());
return question.example();
}
};
@@ -5,7 +5,7 @@ const User = require('../models/user');
module.exports = class UserController {
static hello () {
let user = new User();
user.setName('Wallef');
user.setName('Ben');

return `Hello ${user.name}`;
}
@@ -0,0 +1,7 @@
'use strict';

module.exports = class Question {
example () {
return 'this is an example';
}
};
@@ -4,9 +4,14 @@ const Router = require('koa-router');
const router = new Router();

const UserController = require('./controllers/userController');
const QuestionController = require('./controllers/questionController');

router.get('/', async ctx => {
ctx.body = UserController.hello();
});

router.get('/questions', async ctx => {
ctx.body = QuestionController.showExample();
});

module.exports = router;

0 comments on commit 6e4a85a

Please sign in to comment.