index.js
1.45 KB
/**
* controller 入口
* @author: feng.chen<feng.chen@yoho.cn>
* @date: 2017/04/13
*/
'use strict';
const Express = require('express');
const middleware = require('../framework/middleware');
const before = require('../middleware/before');
const auth = require('../middleware/auth');
const UserController = require('./user-controller');
const FileController = require('./file-controller');
const ImportController = require('./import-controller');
const CaptchaController = require('./captcha-controller');
const GeeCaptchaController = require('./gee-captcha-controller');
const OutputController = require('./output-controller');
let router = Express.Router(); // eslint-disable-line
router.post('/login', middleware(GeeCaptchaController, 'check'), middleware(UserController, 'login'));
router.post('/logout', middleware(UserController, 'logout'));
router.post('/switchShop', before, auth, middleware(UserController, 'switchShop'));
router.post('/upload/image', before, auth, middleware(FileController, 'uploadImage'));
router.post('/import', before, auth, middleware(ImportController, 'import'));
router.get('/export/excel', before, middleware(OutputController, 'exportExcel'));
router.post('/config', middleware(UserController, 'config'));
router.get('/captcha.jpg', middleware(CaptchaController, 'captcha'));
router.get('/geeCaptcha', middleware(GeeCaptchaController, 'captcha'));
router.post('/updatePwd', middleware(UserController, 'updatePwd'));
module.exports = router;