zhangkun9038@dingtalk.com 008c776d93 user fullname
2025-02-17 19:28:36 +08:00
up
2025-02-16 18:05:14 +08:00
2025-02-16 21:51:52 +08:00
2025-02-17 19:28:36 +08:00
up
2025-02-16 20:28:47 +08:00
2025-02-17 19:28:36 +08:00
2025-02-17 19:28:36 +08:00
2025-02-17 19:28:36 +08:00
2025-02-17 19:28:36 +08:00
2025-02-17 19:28:36 +08:00
2025-02-16 21:51:52 +08:00
up
2025-02-16 18:55:51 +08:00
up
2025-02-16 18:55:51 +08:00
2025-02-17 19:28:36 +08:00
2025-02-17 19:28:36 +08:00
up
2025-02-16 18:55:51 +08:00
up
2025-02-16 20:28:47 +08:00

认证相关路由

  1. 注册用户

    curl -X POST http://localhost:8080/auth/register \
    -H "Content-Type: application/json" \
    -d '{"username": "testuser", "password": "testpass", "email": "test@example.com"}'
    
  2. 登录用户

    curl -X POST http://localhost:8080/auth/login \
    -H "Content-Type: application/json" \
    -d '{"username": "testuser", "password": "testpass"}'
    

需要认证的路由

假设登录后返回的token为your_jwt_token_here

用户管理

  1. 获取所有用户

    curl -X GET http://localhost:8080/api/users \
    -H "Authorization: Bearer your_jwt_token_here"
    
  2. 获取单个用户

    curl -X GET http://localhost:8080/api/users/1 \
    -H "Authorization: Bearer your_jwt_token_here"
    
  3. 更新用户

    curl -X PUT http://localhost:8080/api/users/1 \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer your_jwt_token_here" \
    -d '{"name": "updated_name", "email": "updated_email@example.com"}'
    
  4. 删除用户

    curl -X DELETE http://localhost:8080/api/users/1 \
    -H "Authorization: Bearer your_jwt_token_here"
    

角色管理

  1. 创建新角色

    curl -X POST http://localhost:8080/api/roles \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer your_jwt_token_here" \
    -d '{"name": "admin", "description": "Administrator role"}'
    
  2. 获取所有角色

    curl -X GET http://localhost:8080/api/roles \
    -H "Authorization: Bearer your_jwt_token_here"
    
  3. 获取单个角色

    curl -X GET http://localhost:8080/api/roles/1 \
    -H "Authorization: Bearer your_jwt_token_here"
    
  4. 更新角色

    curl -X PUT http://localhost:8080/api/roles/1 \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer your_jwt_token_here" \
    -d '{"name": "updated_role_name", "description": "Updated description"}'
    
  5. 删除角色

    curl -X DELETE http://localhost:8080/api/roles/1 \
    -H "Authorization: Bearer your_jwt_token_here"
    

权限管理

  1. 创建新权限

    curl -X POST http://localhost:8080/api/permissions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer your_jwt_token_here" \
    -d '{"name": "create_user", "description": "Create user permission", "resource": "user", "action": "create"}'
    
  2. 获取所有权限

    curl -X GET http://localhost:8080/api/permissions \
    -H "Authorization: Bearer your_jwt_token_here"
    
  3. 获取单个权限

    curl -X GET http://localhost:8080/api/permissions/1 \
    -H "Authorization: Bearer your_jwt_token_here"
    
  4. 更新权限

    curl -X PUT http://localhost:8080/api/permissions/1 \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer your_jwt_token_here" \
    -d '{"name": "updated_permission_name", "description": "Updated description", "resource": "user", "action": "update"}'
    
  5. 删除权限

    curl -X DELETE http://localhost:8080/api/permissions/1 \
    -H "Authorization: Bearer your_jwt_token_here"
    
Description
No description provided
Readme 12 MiB
Languages
Go 95.8%
Shell 4.2%