mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 11:27:06 +00:00
add a new simple, builtin requestid middleware (makes use of the Context.SetID/GetID methods too)
Former-commit-id: d46bce7c1964adada01934aa95daf389c141defc
This commit is contained in:
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"github.com/iris-contrib/go.uuid"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Generator the type to generate keys(short urls)
|
||||
@@ -11,7 +11,7 @@ type Generator func() string
|
||||
|
||||
// DefaultGenerator is the defautl url generator
|
||||
var DefaultGenerator = func() string {
|
||||
id, _ := uuid.NewV4()
|
||||
id, _ := uuid.NewRandom()
|
||||
return id.String()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Article: https://medium.com/@kataras/a-url-shortener-service-using-go-iris-and-bolt-4182f0b00ae7
|
||||
//
|
||||
// $ go get go.etcd.io/bbolt/...
|
||||
// $ go get github.com/iris-contrib/go.uuid
|
||||
// $ go get github.com/google/uuid
|
||||
// $ cd $GOPATH/src/github.com/kataras/iris/_examples/tutorial/url-shortener
|
||||
// $ go build
|
||||
// $ ./url-shortener
|
||||
|
||||
Reference in New Issue
Block a user