router.js 1.21 KB
/**
 * 路由处理
 * @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`);

// var starClassroom = require(`${routes}/star-classroom`);

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('/wx/lottery', wxLottery.index); // 微信抽奖活动

// app.get('/star/classroom', starClassroom.index); // 星潮教室主页
// app.get('/star/classroom/check-in', starClassroom.checkIn); // 星潮教室签到
// app.get('/star/classroom/subject', starClassroom.subject); // 星潮教室星专题
// app.get('/star/classroom/collocation', starClassroom.collocation); // 星潮教室星搭配

module.exports = app;