solitude

command module
v0.0.0-...-7b3391a Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

README

solitude

Solitude is a project that converts long url into short url,
supports short url jump to long url, and provides data caching and persistence.

中文版README

Project Structure

.
├── LICENSE
├── README.md
├── config
│   └── config.go
├── config.yaml
├── dao
│   ├── mysql.go
│   ├── redis.go
│   └── shorturl.go
├── go.mod
├── go.sum
├── handler
│   └── router.go
├── logic
│   └── shorten.go
└── main.go

Config

need MySQL,Redis
use shorturl.sql create database.table

GIN_MODE: debug
Addr: 5555 

MySQL:
  User: root
  Password: root
  Host: 127.0.0.1:3306
  DBname: test_data
Redis:
  Host: 127.0.0.1:6379
  Password:
  DB: 0  # use default DB

Get Started

1.Enter the project directory and use the command go run main.go to start the project.

2.Set up short url. Visit this in the browser: localhost:5555/shorten?url=https://news.cctv.com/2020/12/08/ARTItP6OrqV93zTT8kxMqKl2201208.shtml?spm=C94212.P4YnMod9m2uD.EfOoEZcMXuiv.9 Get the following information like this: {"message":"eexrTL"}

3.Splicing url. Access the short link in the browser: localhost:5555/expand/eexrTL, and the result is a jump to the corresponding long link, DONE!

Logic

image

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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