summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
authorBoHong Li2017-04-12 05:55:36 +0800
committerRaccoon Li2017-05-08 19:24:38 +0800
commite2ac73f5a36310dead9e23f46004ccef909f317b (patch)
tree66250a7882c7a0ec7e37e79df309fb272ac2c158 /app.js
parente3fde01e3ad2ab8c33aae0ec2960117fd223d242 (diff)
refactor(app.js): Extract /me page
Diffstat (limited to 'app.js')
-rw-r--r--app.js29
1 files changed, 1 insertions, 28 deletions
diff --git a/app.js b/app.js
index 6f707056..2f06de94 100644
--- a/app.js
+++ b/app.js
@@ -199,34 +199,7 @@ app.use(require('./lib/web/baseRouter'))
app.use(require('./lib/web/statusRouter'))
app.use(require('./lib/web/auth'))
app.use(require('./lib/web/historyRouter'))
-
-// get me info
-app.get('/me', function (req, res) {
- if (req.isAuthenticated()) {
- models.User.findOne({
- where: {
- id: req.user.id
- }
- }).then(function (user) {
- if (!user) { return response.errorNotFound(res) }
- var profile = models.User.getProfile(user)
- res.send({
- status: 'ok',
- id: req.user.id,
- name: profile.name,
- photo: profile.photo
- })
- }).catch(function (err) {
- logger.error('read me failed: ' + err)
- return response.errorInternalError(res)
- })
- } else {
- res.send({
- status: 'forbidden'
- })
- }
-})
-
+app.use(require('./lib/web/userRouter'))
// upload image
app.post('/uploadimage', function (req, res) {
var form = new formidable.IncomingForm()