Skip to content

Instantly share code, notes, and snippets.

@gmemstr
Created November 17, 2017 21:05
Show Gist options
  • Save gmemstr/60831109f0ae6c40861c1751a367524e to your computer and use it in GitHub Desktop.
Save gmemstr/60831109f0ae6c40861c1751a367524e to your computer and use it in GitHub Desktop.
Useful Sublime snippets for Pogo development
<!-- Use this to create a new route handler function -->
<snippet>
<content><![CDATA[
func ${2}() common.Handler {
return func(rc *common.RouterContext, w http.ResponseWriter, r *http.Request) *common.HTTPError {
return nil
}
}
]]></content>
<tabTrigger>nrf</tabTrigger>
<scope>source.go</scope>
<description>New router path handler</description>
</snippet>
<!-- Use this to create a new route in router/router.go -->
<snippet>
<content><![CDATA[
r.Handle("/${2}", Handle(
${3}(),
)).Methods(${4})
]]></content>
<tabTrigger>nrp</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.go</scope>
<description>New router path</description>
</snippet>
<!-- Use this to create a new route that requires login in router/router.go -->
<snippet>
<content><![CDATA[
r.Handle("/admin/${2}", Handle(
auth.RequireAuthorization(),
admin.${3}(),
)).Methods(${4})
]]></content>
<tabTrigger>nrpa</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.go</scope>
<description>New authenticated router path</description>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment