Comments (5)
@corebreaker thanks for your interest but it was an easy and quick fix, no need to wait more time for that. Could you please upgrade and confirm if that was the behavior you wanted to or not?
from iris.
Hello, you use the wrong function: when we don't care about order and/or a middleware needed to be registered to all routes (incl parties and subdomains) then we have to use the UseGlobal
instead of Use
function. Give it a try and inform us, thank you.
from iris.
Ah, ok it works, UseGlobal is the right function, thank you.
I knew it, but i thought that it have the same behavior, but i should test it before posting that issue.
from iris.
It's true that with UseGlobal the "/path1.txt" route call the middleware but cause the prepend, the order is inversed:
package main
import (
"github.com/kataras/iris"
"github.com/kataras/iris/context"
)
func main() {
app := iris.New()
app.UseGlobal(func(ctx context.Context) {
ctx.Text("MIDDLEWARE 1\n")
ctx.Next()
})
app.UseGlobal(func(ctx context.Context) {
ctx.Text("MIDDLEWARE 2\n")
ctx.Next()
})
app.Get("/path.txt", func(ctx context.Context) {
ctx.Text("PATH")
})
app.Run(iris.Addr(":8080"))
}
With curl http://localhost:8080/path2.txt ; echo
, we have:
MIDDLEWARE2
MIDDLEWARE1
PATH
We can conserve the order, i'll post a PR, you'll see if you want merge it.
from iris.
Great! It works!
Now designing a server is really powerful. I like Django and Iris is now the best alternative in Go.
from iris.
Related Issues (20)
- [BUG] The cache entry has not been truly deleted after expiration HOT 5
- [BUG] Pluralization uses yml for template configuration, uses ctx.Tr method for rendering, returns no data HOT 1
- [BUG] HOT 3
- [BUG] may be an out-of-boundary bug as a result of lack of necessary argument checks HOT 1
- [BUG] Process hang HOT 1
- [FEATURE REQUEST] redis sentinel support
- [FEATURE REQUEST] Support log/slog HOT 4
- [QUESTION] iris v12.2.0 app.ContextPool.Attach not found HOT 1
- [HELP] How to dynamically start http services on multiple ports? HOT 1
- [HELP] How to proactively send websocket messages to the client in an MVC structure?
- [HELP] Multiple event when using native message
- Iris gRPC wrapper breaking HOT 1
- getBuiltinFuncs problem
- [BUG] template part Unable to load HOT 3
- [BUG] I used goroutine to affect the later HTTP before the service startup HOT 2
- [BUG] validation of binding is not effective
- [QUESTION] The session configuration provided by the iris framework is limited
- [FEATURE REQUEST] Get the data in the session through the session id
- [BUG] ctx.RemoveCookie need more special attribute(`domain` and `path`) value to remove cookies HOT 3
- slog is not in GOROOT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iris.