You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// nolint
// all plugins must have their package name as `main`
// each plugin is isolated at compile time
package main
import (
"net/http"
"github.com/urfave/negroni/v3"
)
// BUILD:
// go build -o ./lib/middlewares/hello.so -buildmode=plugin ./lib/src/middlewares/hello.go
func HelloMiddlewareLoad() negroni.Handler {
return negroni.HandlerFunc(func(rw http.ResponseWriter, rq *http.Request, next http.HandlerFunc) {
rw.Header().Add("X-Hello-Middleware", "Hello Middleware")
next(rw, rq)
})
}
go version go1.22.2 linux/amd64
The text was updated successfully, but these errors were encountered:
Building prest from sources.
In the prest.toml file defined
pluginpath = "./lib"
[pluginmiddlewarelist]
file = "hello"
func = "Hello"
module builded with command
go build -o ./lib/middlewares/hello.so -buildmode=plugin ./lib/src/middlewares/hello.go
(please fix typo mistake in included ./lib/src/middlewares/hello.go
// BUILD:
// go build -o ./lib/midllewares/hello.so -buildmode=plugin ./lib/src/middlewares/hello.go
)
on execute prest with command
go run cmd/prestd/main.go
2024/04/12 12:04:32 it not a negroni middleware function: Hello
Adding some details by modifying ./plugins/middleware.go
taken
2024/04/12 12:24:40 functionref: %!s(func() negroni.Handler=0x7f2051611be0)
2024/04/12 12:24:40 handlerFunc: %!s(negroni.HandlerFunc=)
cat ./lib/src/middlewares/hello.go
go version go1.22.2 linux/amd64
The text was updated successfully, but these errors were encountered: