@@ -6,9 +6,7 @@ var fs = require('fs');
66var Cart = require ( '../models/cart' ) ;
77var products = JSON . parse ( fs . readFileSync ( './data/products.json' , 'utf8' ) ) ;
88
9- router . get ( '/' , function ( req , res , next ) {
10- var productId = products && products [ 0 ] . id ;
11-
9+ router . get ( '/' , function ( _req , res , _next ) {
1210 res . render ( 'index' ,
1311 {
1412 title : 'NodeJS Shopping Cart' ,
@@ -17,7 +15,7 @@ router.get('/', function (req, res, next) {
1715 ) ;
1816} ) ;
1917
20- router . get ( '/add/:id' , function ( req , res , next ) {
18+ router . get ( '/add/:id' , function ( req , res , _next ) {
2119
2220 var productId = req . params . id ;
2321 var cart = new Cart ( req . session . cart ? req . session . cart : { } ) ;
@@ -30,7 +28,7 @@ router.get('/add/:id', function(req, res, next) {
3028 inline ( ) ;
3129} ) ;
3230
33- router . get ( '/cart' , function ( req , res , next ) {
31+ router . get ( '/cart' , function ( req , res , _next ) {
3432 if ( ! req . session . cart ) {
3533 return res . render ( 'cart' , {
3634 products : null
@@ -44,7 +42,7 @@ router.get('/cart', function(req, res, next) {
4442 } ) ;
4543} ) ;
4644
47- router . get ( '/remove/:id' , function ( req , res , next ) {
45+ router . get ( '/remove/:id' , function ( req , res , _next ) {
4846 var productId = req . params . id ;
4947 var cart = new Cart ( req . session . cart ? req . session . cart : { } ) ;
5048
0 commit comments