forked from reisborw/FAQ
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
35 additions
and
34 deletions.
There are no files selected for viewing
0
.githooks/post-commit
100644 → 100755
Empty file.
0
.githooks/pre-commit
100644 → 100755
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
'use strict' | ||
|
||
const User = require('../models/user'); | ||
const User = require('../models/user') | ||
|
||
module.exports = class UserController { | ||
static hello () { | ||
let user = new User() | ||
user.setName('Ben'); | ||
|
||
return `Hello ${user.name}`; | ||
} | ||
}; | ||
static hello() { | ||
const user = new User() | ||
user.setName('Ben') | ||
|
||
return `Hello ${user.name}` | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
module.exports = class Question { | ||
example () { | ||
return 'this is an example'; | ||
} | ||
}; | ||
example() { | ||
return 'this is an example' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
module.exports = class User { | ||
async setName (name) { | ||
return this.name = name; | ||
} | ||
async setName(name) { | ||
return this.name = name | ||
} | ||
|
||
async register () { | ||
// TO DO | ||
} | ||
async register() { | ||
// TO DO | ||
} | ||
|
||
async login () { | ||
// TO DO | ||
} | ||
}; | ||
async login() { | ||
// TO DO | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
'use strict'; | ||
'use strict' | ||
|
||
const Router = require('koa-router'); | ||
const router = new Router(); | ||
const Router = require('koa-router') | ||
const router = new Router() | ||
|
||
const UserController = require('./controllers/userController'); | ||
const QuestionController = require('./controllers/questionController'); | ||
const UserController = require('./controllers/userController') | ||
const QuestionController = require('./controllers/questionController') | ||
|
||
router.get('/', async ctx => { | ||
ctx.body = UserController.hello(); | ||
}); | ||
ctx.body = UserController.hello() | ||
}) | ||
|
||
router.get('/questions', async ctx => { | ||
ctx.body = QuestionController.showExample(); | ||
}); | ||
ctx.body = QuestionController.showExample() | ||
}) | ||
|
||
module.exports = router; | ||
module.exports = router |