summaryrefslogtreecommitdiffstats
path: root/plugin/example_hello_world_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-11-03 11:34:44 -0500
committerChristopher Speller <crspeller@gmail.com>2017-11-03 09:34:44 -0700
commitd2cff9b77cca87c339e65591179a2d7456a6915a (patch)
tree8540cb8ded46b98e195c3517929f3f751db8e5ca /plugin/example_hello_world_test.go
parent71dd21ef3d89f8967b81a6bbfa67b2c85d3ad3e0 (diff)
downloadchat-d2cff9b77cca87c339e65591179a2d7456a6915a.tar.gz
chat-d2cff9b77cca87c339e65591179a2d7456a6915a.tar.bz2
chat-d2cff9b77cca87c339e65591179a2d7456a6915a.zip
more plugin doc updates (#7767)
Diffstat (limited to 'plugin/example_hello_world_test.go')
-rw-r--r--plugin/example_hello_world_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugin/example_hello_world_test.go b/plugin/example_hello_world_test.go
new file mode 100644
index 000000000..5dea28823
--- /dev/null
+++ b/plugin/example_hello_world_test.go
@@ -0,0 +1,20 @@
+package plugin_test
+
+import (
+ "fmt"
+ "net/http"
+
+ "github.com/mattermost/mattermost-server/plugin/rpcplugin"
+)
+
+type HelloWorldPlugin struct{}
+
+func (p *HelloWorldPlugin) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintf(w, "Hello, world!")
+}
+
+// This example demonstrates a plugin that handles HTTP requests which respond by greeting the
+// world.
+func Example_helloWorld() {
+ rpcplugin.Main(&HelloWorldPlugin{})
+}