index.js
988 Bytes
/**
* controller 入口
* @author: feng.chen<feng.chen@yoho.cn>
* @date: 2017/04/13
*/
'use strict';
const Express = require('express');
const UserController = require('./user-controller');
const FileController = require('./file-controller');
const middleware = require('../framework/middleware');
const before = require('../middleware/before');
const auth = require('../middleware/auth');
const multipart = require('connect-multiparty');
const multipartMiddleware = multipart();
let router = Express.Router(); // eslint-disable-line
router.post('/login', middleware(UserController, 'login'));
router.post('/logout', middleware(UserController, 'logout'));
router.post('/switchShop', before, auth, middleware(UserController, 'switchShop'));
router.post('/upload/image', before, auth, multipartMiddleware, middleware(FileController, 'uploadImage'));
router.post('/upload/xlsx', before, auth, multipartMiddleware, middleware(FileController, 'uploadXlsx'));
module.exports = router;