mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
update some examples
Former-commit-id: 2ed7c323dd379eb68d5ccb2044cd9cc772ce0b08
This commit is contained in:
parent
c10dd32ad7
commit
cc19f80049
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,6 +4,4 @@ _authortools
|
|||
.directory
|
||||
node_modules
|
||||
package-lock.json
|
||||
_benchmarks/benchmarker/benchmarker.exe
|
||||
_benchmarks/benchmarker/platforms
|
||||
go.sum
|
|
@ -1,6 +1,7 @@
|
|||
# Table of Contents
|
||||
|
||||
* Tutorials
|
||||
* [Dockerize](tutorial/docker)
|
||||
* [Caddy](tutorial/caddy)
|
||||
* [MongoDB](tutorial/mongodb)
|
||||
* [Dropzone.js](tutorial/dropzonejs)
|
||||
|
@ -79,7 +80,7 @@
|
|||
* [Embedded Single Page Application with other routes](file-server/single-page-application/embedded-single-page-application-with-other-routes/main.go)
|
||||
* View
|
||||
* [Overview](view/overview/main.go)
|
||||
* [Hi](view/template_html_0/main.go)
|
||||
* [Basic](view/template_html_0/main.go)
|
||||
* [A simple Layout](view/template_html_1/main.go)
|
||||
* [Layouts: `yield` and `render` tmpl funcs](view/template_html_2/main.go)
|
||||
* [The `urlpath` tmpl func](view/template_html_3/main.go)
|
||||
|
@ -87,14 +88,14 @@
|
|||
* [Inject Data Between Handlers](view/context-view-data/main.go)
|
||||
* [Embedding Templates Into App Executable File](view/embedding-templates-into-app/main.go)
|
||||
* [Write to a custom `io.Writer`](view/write-to)
|
||||
* [Greeting with Pug (Jade)`](view/template_pug_0)
|
||||
* [Pug (Jade) Actions`](view/template_pug_1)
|
||||
* [Pug (Jade) Includes`](view/template_pug_2)
|
||||
* [Pug (Jade) Extends`](view/template_pug_3)
|
||||
* [Jet](/view/template_jet_0)
|
||||
* [Pug: Greeting](view/template_pug_0)
|
||||
* [Pug: `Actions`](view/template_pug_1)
|
||||
* [Pug: `Includes`](view/template_pug_2)
|
||||
* [Pug: `Extends`](view/template_pug_3)
|
||||
* [Jet Template](/view/template_jet_0)
|
||||
* [Jet Embedded](view/template_jet_1_embedded)
|
||||
* [Jet 'urlpath' tmpl func](/view/template_jet_2)
|
||||
* [Jet template funcs from structure](/view/template_jet_3)
|
||||
* [Jet Template Funcs from Struct](/view/template_jet_3)
|
||||
* Third-Parties
|
||||
* [Render `valyala/quicktemplate` templates](http_responsewriter/quicktemplate)
|
||||
* [Render `shiyanhui/hero` templates](http_responsewriter/herotemplate)
|
||||
|
@ -121,6 +122,7 @@
|
|||
* [Transactions](http_responsewriter/transactions/main.go)
|
||||
* [SSE](http_responsewriter/sse/main.go)
|
||||
* [SSE (third-party package usage for server sent events)](http_responsewriter/sse-third-party/main.go)
|
||||
* [Webassemply](webassemply/basic/main.go)
|
||||
* Cache
|
||||
* [Simple](cache/simple/main.go)
|
||||
* [Client-Side (304)](cache/client-side/main.go)
|
||||
|
|
|
@ -36,7 +36,7 @@ func newApp() *iris.Application {
|
|||
// You can also register any index handler manually, order of registration does not matter:
|
||||
// v1.Get("/static", [...custom middleware...], func(ctx iris.Context) {
|
||||
// [...custom code...]
|
||||
// ctx.ServeFile("./assets/index.html", false)
|
||||
// ctx.ServeFile("./assets/index.html")
|
||||
// })
|
||||
|
||||
// http://localhost:8080/v1/static
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module github.com/kataras/iris/_examples/http-listening/http3-quic
|
||||
|
||||
go 1.12
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/prometheus/client_golang v1.0.0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module app
|
||||
|
||||
go 1.13
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/kataras/iris/v12 v12.2.0
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
// GOARCH=wasm GOOS=js /home/$yourusername/go1.11/bin/go build -o hello.wasm hello_go111.go
|
||||
// GOARCH=wasm GOOS=js /home/$yourusername/go1.14/bin/go build -o hello.wasm hello_go114.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)
|
|
@ -5,8 +5,8 @@ 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.11/bin/go build -o hello.wasm hello_go111.go
|
||||
You need to build the hello.wasm first, download the go1.14 and execute the below command:
|
||||
$ cd client && GOARCH=wasm GOOS=js /home/$yourname/go1.14/bin/go build -o hello.wasm hello_go114.go
|
||||
*/
|
||||
|
||||
func main() {
|
||||
|
@ -17,7 +17,8 @@ func main() {
|
|||
app.HandleDir("/", "./client")
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.ServeFile("./client/hello.html", false) // true for gzip.
|
||||
// ctx.Gzip(true)
|
||||
ctx.ServeFile("./client/hello.html")
|
||||
})
|
||||
|
||||
// visit http://localhost:8080
|
||||
|
|
|
@ -110,7 +110,7 @@ func main() {
|
|||
|
||||
// serves the browser-based websocket client.
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.ServeFile("./browser/index.html", false)
|
||||
ctx.ServeFile("./browser/index.html")
|
||||
})
|
||||
|
||||
// serves the npm browser websocket client usage example.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module github.com/kataras/iris/_examples/websocket/socketio
|
||||
|
||||
go 1.13
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/googollee/go-socket.io v1.4.3-0.20191109153049-7451e2f8c2e0
|
||||
github.com/kataras/iris/v12 v12.1.8
|
||||
github.com/kataras/iris/v12 v12.2.0
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user