function route(expressApp){

    expressApp.get('/couponMember', 'couponMember', expressApp.restrict, function (req, res) {
        expressApp.models.CouponMember.findAll().then(function(results) {
            res.render('couponMember/list', {
                title: 'Members',
                listObjs: results
            });
        }).catch(function(err) {
            next(err);
        });
    });

    expressApp.get('/couponMember/create', 'couponMember.create', expressApp.restrict, function (req, res) {

        res.render('couponMember/create', {
            title: 'CouponMembers Create'
        });
    });

    expressApp.get('/couponMember/:id', 'couponMember.show', expressApp.restrict, function(req, res) {
        var couponMemberId = req.params.id;
        expressApp.models.CouponMember.findOne({
            where: {
                CouponMemberID: couponMemberId
            }
        })
        .then(function(result){
            res.render('couponMember/edit', {
                title: 'CouponMember',
                obj : result
            });
        }).catch(function(err) {
            next(err);
        });

    });

    expressApp.post('/couponMember/', 'couponMember.store', expressApp.restrict, function(req, res, next) {
        var couponMember = req.body.CouponMember;
        expressApp.models.CouponMember.create({
            CouponMemberID : couponMember.CouponMemberID
            , CouponID: couponMember.CouponID
            , MemberID : couponMember.MemberID

            , sCol1 : couponMember.sCol1 || ''
            , sCol2 : couponMember.sCol2 || ''
            , sCol3 : couponMember.sCol3 || ''
            , sCol4 : couponMember.sCol4 || ''
            , sCol5 : couponMember.sCol5 || ''
            , sCol6 : couponMember.sCol6 || ''
            , sCol7 : couponMember.sCol7 || ''
            , sCol8 : couponMember.sCol8 || ''
            , sCol9 : couponMember.sCol9 || ''
            , sCol10 : couponMember.sCol10 || ''

            , HideYN : couponMember.HideYN
            , DeleteYN : couponMember.DeleteYN
            , DataFromRegion : couponMember.DataFromRegion || ''
            , DataFromRegionDT : couponMember.DataFromRegionDT || '1900-01-01 00:00:00:000 +00:00'

        }).then(function() {
            res.redirect('/couponMember');
        }).catch(function(err) {
            next(err);
        });
    });

    expressApp.post('/couponMember/edit', 'couponMember.update', expressApp.restrict, function(req, res, next) {
        var couponMember = req.body.CouponMember;
        expressApp.models.CouponMember.update({
            CouponID: couponMember.CouponID
            , MemberID : couponMember.MemberID

            , sCol1 : couponMember.sCol1
            , sCol2 : couponMember.sCol2
            , sCol3 : couponMember.sCol3
            , sCol4 : couponMember.sCol4
            , sCol5 : couponMember.sCol5
            , sCol6 : couponMember.sCol6
            , sCol7 : couponMember.sCol7
            , sCol8 : couponMember.sCol8
            , sCol9 : couponMember.sCol9
            , sCol10 : couponMember.sCol10

            , HideYN : couponMember.HideYN
            , DeleteYN : couponMember.DeleteYN
        }, {
            where : {CouponMemberID : couponMember.CouponMemberID}
        }).then(function() {
            res.redirect('/couponMember');
        }).catch(function(err) {
            next(err);
        });
    });
}

module.exports = route;

@@ -105,32 +105,38 @@
 nction (req, res
+, next
 ) %7B%0A        expr
@@ -135,62 +135,578 @@
     
-expressApp.models.CouponMember.findAll().then(function
+var perPage = 15;%0A        var currentPage = Number(req.query.page %7C%7C 1);%0A        var filter = %7B%7D;%0A%0A        var Model = expressApp.models.CouponMember;%0A%0A        Model.findAll(%7B%0A                where : filter%0A            %7D)%0A            .then(function(filteredModel) %7B%0A                var count = filteredModel.length;%0A%0A                Model.findAll(%7B%0A                        where : filter,%0A                        limit : perPage,%0A                        offset : (currentPage %3C= 1) ? 0 : perPage*(currentPage-1)%0A                    %7D)%0A                    .then(function 
 (res
@@ -717,32 +717,44 @@
 ) %7B%0A            
+     
+       
 res.render('coup
@@ -787,24 +787,36 @@
         
+            
 title: '
 Members'
@@ -807,16 +807,23 @@
 title: '
+Coupon 
 Members'
@@ -840,16 +840,28 @@
         
+          
+  
 listObjs
@@ -869,17 +869,116 @@
  results
-%0A
+,%0A                            page:currentPage,%0A                            count:count%0A            
         
@@ -985,32 +985,44 @@
     %7D);%0A        
+      
+      
 %7D).catch(functio
@@ -1018,32 +1018,33 @@
 tch(function
+ 
 (err) %7B%0A
             
@@ -1023,32 +1023,120 @@
 unction (err) %7B%0A
+                    next(err);%0A                %7D);%0A%0A            %7D).catch(function(err)%7B%0A
             next

modify list paginaton for coupon member