mirror of
https://github.com/kataras/iris.git
synced 2026-01-01 09:17:02 +00:00
remove 'WithoutVersionChecker', update and test the new versions of some of the dependencies, add a history entry with unknown release date
Former-commit-id: 399db6aac44d3b336648d6d61842f4d7a0266842
This commit is contained in:
@@ -50,8 +50,6 @@ func main() {
|
||||
app.Run(
|
||||
// Start the web server at localhost:8080
|
||||
iris.Addr("localhost:8080"),
|
||||
// disables updates:
|
||||
iris.WithoutVersionChecker,
|
||||
// skip err server closed when CTRL/CMD+C pressed:
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
// enables faster json serialization and more:
|
||||
|
||||
@@ -34,7 +34,6 @@ func main() {
|
||||
|
||||
app.Run(
|
||||
iris.Addr(":8080"),
|
||||
iris.WithoutVersionChecker,
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ func main() {
|
||||
|
||||
// http://localhost:8080?referer=https://twitter.com/Xinterio/status/1023566830974251008
|
||||
// http://localhost:8080?referer=https://www.google.com/search?q=Top+6+golang+web+frameworks&oq=Top+6+golang+web+frameworks
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed), iris.WithoutVersionChecker)
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
|
||||
}
|
||||
|
||||
@@ -79,8 +79,6 @@ func main() {
|
||||
app.Run(
|
||||
// Starts the web server at localhost:8080
|
||||
iris.Addr("localhost:8080"),
|
||||
// Disables the updater.
|
||||
iris.WithoutVersionChecker,
|
||||
// Ignores err server closed log when CTRL/CMD+C pressed.
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
// Enables faster json serialization and more.
|
||||
|
||||
@@ -33,8 +33,6 @@ func main() {
|
||||
app.Run(
|
||||
// Start the web server at localhost:8080
|
||||
iris.Addr("localhost:8080"),
|
||||
// disables updates:
|
||||
iris.WithoutVersionChecker,
|
||||
// skip err server closed when CTRL/CMD+C pressed:
|
||||
iris.WithoutServerError(iris.ErrServerClosed),
|
||||
// enables faster json serialization and more:
|
||||
|
||||
@@ -68,5 +68,5 @@ func main() {
|
||||
// 3. refresh the page some times
|
||||
// 4. close the browser
|
||||
// 5. re-open the browser and re-play 2.
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutVersionChecker)
|
||||
app.Run(iris.Addr(":8080"))
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Listen for incoming HTTP/1.x & HTTP/2 clients on localhost port 8080.
|
||||
app.Run(iris.Addr(":8080"), iris.WithCharset("UTF-8"), iris.WithoutVersionChecker)
|
||||
app.Run(iris.Addr(":8080"), iris.WithCharset("UTF-8"))
|
||||
}
|
||||
|
||||
func logThisMiddleware(ctx iris.Context) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Article: https://medium.com/@kataras/a-url-shortener-service-using-go-iris-and-bolt-4182f0b00ae7
|
||||
//
|
||||
// $ go get github.com/coreos/bbolt
|
||||
// $ go get github.com/etcd-io/bbolt
|
||||
// $ go get github.com/satori/go.uuid
|
||||
// $ cd $GOPATH/src/github.com/kataras/iris/_examples/tutorial/url-shortener
|
||||
// $ go build
|
||||
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/coreos/bbolt"
|
||||
"github.com/etcd-io/bbolt"
|
||||
)
|
||||
|
||||
// Panic panics, change it if you don't want to panic on critical INITIALIZE-ONLY-ERRORS
|
||||
@@ -28,17 +28,17 @@ var (
|
||||
// Only one table/bucket which contains the urls, so it's not a fully Database,
|
||||
// it works only with single bucket because that all we need.
|
||||
type DB struct {
|
||||
db *bolt.DB
|
||||
db *bbolt.DB
|
||||
}
|
||||
|
||||
var _ Store = &DB{}
|
||||
|
||||
// openDatabase open a new database connection
|
||||
// and returns its instance.
|
||||
func openDatabase(stumb string) *bolt.DB {
|
||||
func openDatabase(stumb string) *bbolt.DB {
|
||||
// Open the data(base) file in the current working directory.
|
||||
// It will be created if it doesn't exist.
|
||||
db, err := bolt.Open(stumb, 0600, nil)
|
||||
db, err := bbolt.Open(stumb, 0600, nil)
|
||||
if err != nil {
|
||||
Panic(err)
|
||||
}
|
||||
@@ -48,7 +48,7 @@ func openDatabase(stumb string) *bolt.DB {
|
||||
tableURLs,
|
||||
}
|
||||
|
||||
db.Update(func(tx *bolt.Tx) (err error) {
|
||||
db.Update(func(tx *bbolt.Tx) (err error) {
|
||||
for _, table := range tables {
|
||||
_, err = tx.CreateBucketIfNotExists(table)
|
||||
if err != nil {
|
||||
@@ -73,7 +73,7 @@ func NewDB(stumb string) *DB {
|
||||
// Set sets a shorten url and its key
|
||||
// Note: Caller is responsible to generate a key.
|
||||
func (d *DB) Set(key string, value string) error {
|
||||
return d.db.Update(func(tx *bolt.Tx) error {
|
||||
return d.db.Update(func(tx *bbolt.Tx) error {
|
||||
b, err := tx.CreateBucketIfNotExists(tableURLs)
|
||||
// Generate ID for the url
|
||||
// Note: we could use that instead of a random string key
|
||||
@@ -106,7 +106,7 @@ func (d *DB) Set(key string, value string) error {
|
||||
|
||||
// Clear clears all the database entries for the table urls.
|
||||
func (d *DB) Clear() error {
|
||||
return d.db.Update(func(tx *bolt.Tx) error {
|
||||
return d.db.Update(func(tx *bbolt.Tx) error {
|
||||
return tx.DeleteBucket(tableURLs)
|
||||
})
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func (d *DB) Clear() error {
|
||||
// Returns an empty string if not found.
|
||||
func (d *DB) Get(key string) (value string) {
|
||||
keyB := []byte(key)
|
||||
d.db.Update(func(tx *bolt.Tx) error {
|
||||
d.db.Update(func(tx *bbolt.Tx) error {
|
||||
b := tx.Bucket(tableURLs)
|
||||
if b == nil {
|
||||
return nil
|
||||
@@ -138,7 +138,7 @@ func (d *DB) Get(key string) (value string) {
|
||||
// GetByValue returns all keys for a specific (original) url value.
|
||||
func (d *DB) GetByValue(value string) (keys []string) {
|
||||
valueB := []byte(value)
|
||||
d.db.Update(func(tx *bolt.Tx) error {
|
||||
d.db.Update(func(tx *bbolt.Tx) error {
|
||||
b := tx.Bucket(tableURLs)
|
||||
if b == nil {
|
||||
return nil
|
||||
@@ -159,7 +159,7 @@ func (d *DB) GetByValue(value string) (keys []string) {
|
||||
|
||||
// Len returns all the "shorted" urls length
|
||||
func (d *DB) Len() (num int) {
|
||||
d.db.View(func(tx *bolt.Tx) error {
|
||||
d.db.View(func(tx *bbolt.Tx) error {
|
||||
|
||||
// Assume bucket exists and has keys
|
||||
b := tx.Bucket(tableURLs)
|
||||
|
||||
@@ -530,7 +530,7 @@ func main() {
|
||||
todosApp.Handle(new(controllers.TodoController))
|
||||
|
||||
// start the web server at http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutVersionChecker)
|
||||
app.Run(iris.Addr(":8080"))
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -51,5 +51,5 @@ func main() {
|
||||
todosApp.Handle(new(controllers.TodoController))
|
||||
|
||||
// start the web server at http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"), iris.WithoutVersionChecker)
|
||||
app.Run(iris.Addr(":8080"))
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build go1.11beta3
|
||||
// +build go1.11
|
||||
|
||||
package main
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// GOARCH=wasm GOOS=js /home/$yourusername/go1.11beta1/bin/go build -o hello.wasm hello_go11beta2.go
|
||||
// GOARCH=wasm GOOS=js /home/$yourusername/go1.11/bin/go build -o hello.wasm hello_go111.go
|
||||
js.Global().Get("console").Call("log", "Hello WebAssemply!")
|
||||
message := fmt.Sprintf("Hello, the current time is: %s", time.Now().String())
|
||||
js.Global().Get("document").Call("getElementById", "hello").Set("innerText", message)
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
/*
|
||||
You need to build the hello.wasm first, download the go1.11 and execute the below command:
|
||||
$ cd client && GOARCH=wasm GOOS=js /home/$yourname/go1.11beta3/bin/go build -o hello.wasm hello_go11beta3.go
|
||||
$ cd client && GOARCH=wasm GOOS=js /home/$yourname/go1.11/bin/go build -o hello.wasm hello_go111.go
|
||||
*/
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user