For the moment, the Iris extension provides some very useful code snippets to reduce the time you spend to write common Iris Go code inside the Microsoft's Visual Studio Code, which is the best code editor for the Go Language.
Snippets section contains the documentation for each snippet(word that is auto-completed by the Visual Studio Code's editor when you type its prefix, with the key <tab>
you can actually apply the code that is referring to the snippet and by pressing <tab>
again you can change the default values for each code snippet's body).
The Iris extension will install the vscode-go extension automatically for you, if it is not there already.
app.PartyConfigure("/", new(users.API))
package api
import (
"github.com/kataras/iris/v12"
)
type API struct {
}
func (api *API) Configure(r iris.Party) {
}
package main
import (
"time"
"github.com/kataras/iris/v12"
)
func greet(ctx iris.Context) {
ctx.Writef("Hello World! %s", time.Now())
}
func main() {
app := iris.New()
app.Get("/", greet)
app.Listen(":8080")
}
app := iris.New()
app.Run(iris.Addr(":8080"))
sessionsManager := sessions.New(sessions.Config{
Cookie: "cookieName",
})
app.RegisterView(iris.HTML("./views", ".html"))
app.HandleDir("/path", "./directory")
app.HandleDir("/path", "./directory", iris.DirOptions{Asset: Asset, AssetNames: AssetNames})
app.Favicon("./public/favicon.ico")
func(ctx iris.Context) {
}
app.Handle("GET", "/path", func(ctx iris.Context) {
})
app.Get("/path", func(ctx iris.Context) {
})
app.Post("/path", func(ctx iris.Context) {
})
app.Put("/path", func(ctx iris.Context) {
})
app.Delete("/path", func(ctx iris.Context) {
})
Just click the link below and press the Install button, vs code will open and ask you if you want to install the extension.
https://marketplace.visualstudio.com/items?itemName=kataras2006.iris