
import express from "express";
import {
    login,
    logout,
    getProductList,
    getProductDetail,
    createProduct,
    updateProduct,
    deleteProduct
}
    from "../controller/adminController.js";

import {jwtMiddleware} from "../middleware/jwt.js"

const adminRouter = express.Router();

// 登录
adminRouter.post("/login", login);
// 登出
adminRouter.get("/logout", logout);

// 后台商品列表
adminRouter.get("/product",jwtMiddleware, getProductList);
// 商品详情
adminRouter.get("/product/:productId", getProductDetail);
// 商品添加
adminRouter.post("/product", createProduct);
// 商品修改
adminRouter.put("/product", updateProduct);
// 商品删除
adminRouter.delete("/product/:productId", deleteProduct);


export default adminRouter;

