full

command
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package main 是 xlgo 的完整示例:MySQL + Redis + JWT + 一个 user CRUD。

运行前需准备:

  • MySQL(config.yaml 中 database 配置)
  • Redis(config.yaml 中 redis 配置)

启动后会自动迁移 user 表。访问:

POST /api/v1/login           {"username":"alice","password":"secret"}  → 返回 token
GET  /api/v1/users/:id       (需 Authorization: Bearer <token>)
POST /api/v1/users           (需 Authorization: Bearer <token>,创建用户)

示例会在启动时初始化 alice/secret,密码以 bcrypt 哈希保存。

运行:

go run ./examples/full

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL