Hi! I uploaded a custom plugin, but while trying to execute it by calling:
http://{MatterMost_URL}/plugins/{Plugin_ID}
i got 404 not found.
Notes:
i am developing my code on windows and deploying on linux server (MatterMost server).
so, i executed these commands before build:
GOOS=linux
GOARCH=amd64
Then build using:
go build -o plugin.exe plugin.go
///////////////////////////////////////////////////////////
plugin.go code:
package main
import (
“net/http”
“github.com/mattermost/mattermost-server/plugin”
)
type HelloWorldPlugin struct {
plugin.MattermostPlugin
Enabled bool
Secret string
UserName string
}
func (p *HelloWorldPlugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
if !p.Enabled || p.Secret == “” || p.UserName == “” {
http.Error(w, “This plugin is not configured.”, http.StatusForbidden)
return
}
}
// This example demonstrates a plugin that handles HTTP requests which respond by greeting the
// world.
func main() {
plugin.ClientMain(&HelloWorldPlugin{})
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
plugin.yaml:
id: com.mattermost.server-hello-world
name: Server “Hello, world!”
server:
executable: ./plugin.exe
//////////////////////////////////////////////////////////////////////////////////////////////////////////////