github.com/haalcala/mattermost-server-change-repo@v0.0.0-20210713015153-16753fbeee5f/plugin/example_hello_world_test.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package plugin_test 5 6 import ( 7 "fmt" 8 "net/http" 9 10 "github.com/mattermost/mattermost-server/v5/plugin" 11 ) 12 13 // HelloWorldPlugin implements the interface expected by the Mattermost server to communicate 14 // between the server and plugin processes. 15 type HelloWorldPlugin struct { 16 plugin.MattermostPlugin 17 } 18 19 // ServeHTTP demonstrates a plugin that handles HTTP requests by greeting the world. 20 func (p *HelloWorldPlugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) { 21 fmt.Fprint(w, "Hello, world!") 22 } 23 24 // This example demonstrates a plugin that handles HTTP requests which respond by greeting the 25 // world. 26 func Example_helloWorld() { 27 plugin.ClientMain(&HelloWorldPlugin{}) 28 }