tinyurl

command module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

Overview

This is a simple, available short-address service.

Online Test

Quick Start

1. configuration database

CREATE database tinyurl;
USE tinyurl;
CREATE TABLE `tinyurl` (
  `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  `url` varchar(255) DEFAULT NULL COMMENT 'URL',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8;

2. develop and debug

2.1 Modify configuration file
vim ./config/config.yaml

Notice Please modify the domainand database address

2.2 start
go run main.go web
2.3 test

1)generate short address

curl -XPOST http://localhost:8080/api/tinyurl -d '{"url":"http://vearne.cc/archives/39217"}'

2)watch result

curl -iv http://st.vearne.cc/2h7
curl -L http://st.vearne.cc/2h7

You can also test directly in a browse.

seq chart

3. Production Environment

3.1 compile
go build -ldflags "-s -w" -o tinyurl
3.2 start
./tinyurl web --config ./config/config.yaml

4. Thanks

The project inspired by 国内有哪些靠谱的短链接服务?

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