Skip to content

kataras/vscode-iris

Repository files navigation

Iris for Visual Studio Code

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.

Snippets

pc

app.PartyConfigure("/", new(users.API))

api

package api

import (
	"github.com/kataras/iris/v12"
)

type API struct {
}

func (api *API) Configure(r iris.Party) {
	
}

helloweb

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")
}

newapp

app := iris.New()


app.Run(iris.Addr(":8080"))

newsessions

sessionsManager := sessions.New(sessions.Config{
    Cookie: "cookieName",
})

regview

app.RegisterView(iris.HTML("./views", ".html"))

handledir

app.HandleDir("/path", "./directory")

staticembedded

app.HandleDir("/path", "./directory", iris.DirOptions{Asset: Asset, AssetNames: AssetNames})

fav

app.Favicon("./public/favicon.ico")

hf

func(ctx iris.Context) {

}

handle

app.Handle("GET", "/path", func(ctx iris.Context) {

})

get

app.Get("/path", func(ctx iris.Context) {

})

post

app.Post("/path", func(ctx iris.Context) {

})

put

app.Put("/path", func(ctx iris.Context) {

})

delete

app.Delete("/path", func(ctx iris.Context) {

})

Install from Marketplace

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