index.js
928 Bytes
const express = require('express');
const router = express.Router();
const app = express();
const ufoCtrl = require('./ufo/controller');
const passportCtrl = require('./passport/controller');
const auth = global.auth;
router.get('/ufo_du/sales', auth, ufoCtrl.getSalesStats);
router.get('/stats/top300/stock', auth, ufoCtrl.getTop300Stock);
router.get('/stats/top300/stock/export', auth, ufoCtrl.exportTop300Stock);
router.post('/passport/login', passportCtrl.loginByPassword);
router.get('/passport/account/list', auth, passportCtrl.checkAdmin, passportCtrl.accountList);
router.post('/passport/account/add', auth, passportCtrl.checkAdmin, passportCtrl.accountAdd);
router.post('/passport/account/delete', auth, passportCtrl.checkAdmin, passportCtrl.accountDelete);
app.use(router);
app.all('*', (req, res) => {
return res.json({
code: 404,
message: 'api not found'
});
});
module.exports = app;