router.js 913 Bytes
/**
 * 路由处理
 * @author: xuqi<qi.xu@yoho.cn>
 * @date: 2016/3/28
 */
const express = require('express');

const app = new express.Router();
const routes = './routes';

// middleware
const auth = require('./middleware/auth'); // 登录判断

// Module Controller
var index = require(`${routes}/index`);
var conpon = require(`${routes}/coupon`);
var conponSummer = require(`${routes}/coupon/summer`);
var wxLottery = require(`${routes}/wx-lottery/index`);

app.get('/', index.index); // 主页

app.get('/user/checkLogin', index.index); // 检查登录 JSONP接口

app.post('/coupon/getSingleCoupon', conpon.getCoupon); // 领券 JSON接口,TODO:可跨域
app.get('/coupon/summer/1', auth, conponSummer.first); // 夏日领券第一波
app.get('/coupon/summer/2', auth, conponSummer.second); // 夏日领券第一波

app.get('/wx/lottery', wxLottery.index); // 微信抽奖活动

module.exports = app;