GithubHelp home page GithubHelp logo

shopping-store-server's People

Contributors

codeshihaoran avatar

Stargazers

 avatar

Watchers

 avatar

shopping-store-server's Issues

code review

  1. 不可修改或者不会改变的变量都应该使用const,比如下面代码中除了变量i会自增变化外,其他都应使用const

image

  1. 参数命名要统一成驼峰式,另外这里total咋还返回了个写死的数
    image

  2. 这俩函数是写重复了?
    image

  3. 命名,要注意点呀,好好检查一下有问题的都改了吧
    image

  4. middleware可以和auth一样,直接传入router,就不用手动调用了
    image

  5. 其实像这种格式校验(完全不需要后端操作数据库)一般都会放在前端,在用户输入框blur的时候就立马提示出来,按钮置灰,只有格式都正确了才能点击按钮去登录/注册,这样更快。等请求过来才校验格式有没有问题就太慢了
    image

  6. 数据库字段命名统一下划线连接
    image

  7. 接口路径一般是遵从RESTFUL API设计规范,可以看下 这个,之前写的是有问题的,比如
    orderRouter.post('/user/order/addOrder', auth.checkIsLogin, orderController.addProductsToOrder) shoppingRouter.post('/user/shoppingCart/getShoppingCart', auth.checkIsLogin, shoppingcartController.getShoppingCartProducts) shoppingRouter.post('/user/shoppingCart/deleteShoppingCart', auth.checkIsLogin, shoppingcartController.deleteShopingProducts)
    正确的应该是这样:
    orderRouter.post('/user/order/add', auth.checkIsLogin, orderController.addProductsToOrder) shoppingRouter.post('/user/shopping_cart/list', auth.checkIsLogin, shoppingcartController.getShoppingCartProducts) shoppingRouter.post('/user/shopping_cart/delete', auth.checkIsLogin, shoppingcartController.deleteShopingProducts)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.