github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+incompatible/plugin/example_hello_world_test.go (about) 1 package plugin_test 2 3 import ( 4 "fmt" 5 "net/http" 6 7 "github.com/mattermost/mattermost-server/plugin/rpcplugin" 8 ) 9 10 type HelloWorldPlugin struct{} 11 12 func (p *HelloWorldPlugin) ServeHTTP(w http.ResponseWriter, r *http.Request) { 13 fmt.Fprintf(w, "Hello, world!") 14 } 15 16 // This example demonstrates a plugin that handles HTTP requests which respond by greeting the 17 // world. 18 func Example_helloWorld() { 19 rpcplugin.Main(&HelloWorldPlugin{}) 20 }