hertz_session

command module
v0.0.0-...-231bdf8 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

hertz_session

Introduce

A demo with Hertz and Session, this demo aims to demonstrate a distributed session solution based on the hertz-contrib/sessions.

The distributed session solution based on redis is to store the sessions of different servers in redis or redis cluster, which aims to solve the problem that the sessions of multiple servers are not synchronized in the case of distributed system.

  • Use thrift IDL to define HTTP interface
  • Use hz to generate code
  • Use hertz-contrib/sessions to store sessions
  • Use hertz-contrib/csrf to prevent Cross-Site Request Forgery attacks
  • Use Gorm and MySQL
  • Use AdminLTE as frontend page

hertz-contrib/sessions

Use Hertz's sessions extension, refer to hertz-contrib/sessions

hertz-contrib/csrf

Use Hertz's csrf extension, refer to hertz-contrib/csrf

IDL

This demo use thrift IDL to define HTTP interface. The specific interface define in user.thrift

Code generation tool

This demo use hz to generate code. The use of hz refers to hz

The hz commands used can be found in Makefile

Binding and Validate

The use of binding and Validate refers to Binding and Validate

Gorm

This demo use Gorm to operate MySQL and refers to Gorm

AdminLTE

This demo captures the AdminLTE login and registration page as the front-end page.

How to run

Run MySQL and Redis docker
cd bizdemo/hertz_session && docker-compose up
Run demo
cd bizdemo/hertz_session
go run .
Web Page Presentation
  • Registration Page

register

  • Login Page

login

  • Index Page

index

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
biz
dal
mw
pkg

Jump to

Keyboard shortcuts

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