Code Monkey home page Code Monkey logo

shopping-store-server's Introduction

Shopping-store-server

技术栈

  • 后端基于:koa2+node.js
  • 数据库:MySQL+TiDB

项目背景

项目前言

Shopping-store-server 项目是一个为商城系统提供后端支持的应用。为了实现商城前台和后台的功能需求,该项目采用 Node.js 搭建后端服务器,

项目来源

在商城前后台的基础上,学生学习了Node.js来搭建商城后端模块,该项目不仅为前端提供数据服务,处理用户请求,管理商品和订单信息,并确保系统的安全性和稳定性。也提升了学生在Node.jskoa2框架的实战经验。

功能特性

  • 用户管理: 注册、登录、权限验证、用户信息查询和更新。
  • 商品管理: 商品的添加、删除、修改、查询,库存管理。
  • 订单管理: 订单创建、查询、修改和状态更新。
  • 其他功能: 数据统计、日志记录、错误处理等。

安装依赖

npm install

项目运行

npm run test

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.