minor spelling and formatting

Gerasimos (Makis) Maropoulos 2019-07-02 14:41:50 +03:00
parent 6abc331464
commit 6aba338d0e
No known key found for this signature in database
GPG Key ID: F169457BBDA4ACF4
8 changed files with 37 additions and 23 deletions

@ -35,7 +35,7 @@ These are the words I told myself that day [**13 March 2016**].
The same day, later the night, I was reading a book about Greek mythology. I saw an ancient goddess name there and I was immediately inspired to give her name to this new web framework I was already started to design and code - **Iris**.
Some weeks later, Iris was trending on position #1 in Github for **all languages**, this is very rare phenomenon especially for a new personal project, back then, with such a young developer behind it. After that, as was reasonable, competitors who couldn't handle their losses, and individuals with low self-esteem began to pull out themselves and their jealousy about the success of others, started to randomly throw defamations and fake news around. Of course they never even thought to argument on the fact that Iris the fastest and greatest in terms of performance and features because numbers never lie and their whole narrative would fall very fast. Instead they try to bullying me through my personality, they tried to put me down in order to stop the active development of Iris -- But of course they didn't know me well back then, I'm overwhelmingly compassionate and righteous person but softiness does not belong in my characteristics. They think that they deserve the same reputation because they think they work hard too but, sadly, they can't realize a simple fact of life: they don't work hard enough to release a succeed product that people will immediately fall in love, trust and use on their jobs and this is the most important reason behind their hatred for success.
Some weeks later, Iris was trending on position #1 in Github for **all languages**, this is very rare phenomenon especially for a new personal project, back then, with such a young developer behind it. After that, as was reasonable, competitors who couldn't handle their losses, and individuals with low self-esteem began to pull out themselves and their jealousy about the success of others, started to randomly throw defamations and fake news around. Of course they never even thought to argument on the fact that Iris the fastest and greatest in terms of performance and features because numbers never lie and their whole narrative would fall very fast. Instead they tried to bullying me through my personality, they tried to put me down in order to stop the active development of Iris -- But of course they didn't know me well back then, I'm overwhelmingly compassionate and righteous person but softiness does not belong in my characteristics. They think that they deserve the same reputation because they think they work hard too but, sadly, they can't realize a simple fact of life: they don't work hard enough to release a succeed product that people will immediately fall in love, trust and use on their jobs and this is the most important reason behind their hatred for success.
However, I strongly believe that we should not respond back with the same coin, instead, I think we should prove them that compassion and love live inside each one of us, by forgiving them and their actions and look forward for a better place to express ourselves without fear and racism.

@ -11,8 +11,8 @@ This wiki is the main source of documentation for **developers** working with (o
* [[Routing]]
* [[Path Parameter Types|Routing-path-parameter-types]]
* [[Reverse Lookups|Routing-reverse-lookups]]
* [[Use and Write middleware|Routing-middleware]]
* [[Custom error handlers|Routing-error-handlers]]
* [[Middleware|Routing-middleware]]
* [[Handle HTTP errors|Routing-error-handlers]]
* [[Wrap the Router|Routing-wrap-the-router]]
## Runnable Examples

@ -69,14 +69,14 @@ func main() {
app.Get("/", indexHandler)
app.Get("/contact", contactHandler)
// Order of those calls doesn't matter, `UseGlobal` and `DoneGlobal`
// are applied to existing routes and future routes.
// Order of those calls does not matter,
// `UseGlobal` and `DoneGlobal` are applied to existing routes
// and future routes also.
//
// Remember: the `Use` and `Done` are applied to the current party's and its children,
// so if we used the `app.Use/Don`e before the routes registration
// it would work like UseGlobal/DoneGlobal in this case, because the `app` is the root party.
//
// See `app.Party/PartyFunc` for more.
// so if we used the `app.Use/Done before the routes registration
// it would work like UseGlobal/DoneGlobal in this case,
// because the `app` is the root "Party".
app.UseGlobal(before)
app.DoneGlobal(after)
@ -106,10 +106,20 @@ func contactHandler(ctx iris.Context) {
}
```
Any third-party middleware that written for `net/http` is automatic compatible with Iris using the `iris.FromStd(aThirdPartyMiddleware)`. Remember, `ctx.ResponseWriter()` and `ctx.Request()` returns the same `net/http` input arguments for an `http.Handler`. See [here](https://github.com/kataras/iris/tree/master/_examples/convert-handlers) for an example.
You could also use the `ExecutionRules` to force Done handlers to be executed without the need of `ctx.Next()` in your route handlers, do it like this:
```go
app.SetExecutionRules(iris.ExecutionRules{
// Begin: ...
// Main: ...
Done: iris.ExecutionOptions{Force: true},
})
```
---------------------
Any third-party middleware that written for `net/http` is automatic compatible with Iris using the `iris.FromStd(aThirdPartyMiddleware)`. Remember, `ctx.ResponseWriter()` and `ctx.Request()` returns the same `net/http` input arguments for an `http.Handler`. See [here](https://github.com/kataras/iris/tree/master/_examples/convert-handlers) for an example.
Here is a list of some handlers made specifically for Iris:
## Built-in

@ -9,7 +9,7 @@ otherwise it pre-compiles the regexp and adds the necessary middleware(s). That
## Parameters
A path parameter's name should contain only alphabetical letters or digits. Symbols like '_' are NOT allowed.
A path parameter's name should contain only alphabetical letters. Numbers or symbols like '_' are NOT allowed.
Do not confuse `ctx.Params()` with `ctx.Values()`.
@ -79,7 +79,8 @@ latLonRegex, _ := regexp.Compile(latLonExpr)
// MatchString is a type of func(string) bool, so we use it as it is.
app.Macros().Get("string").RegisterFunc("coordinate", latLonRegex.MatchString)
app.Get("/coordinates/{lat:string coordinate()}/{lon:string coordinate()}", func(ctx iris.Context) {
app.Get("/coordinates/{lat:string coordinate()}/{lon:string coordinate()}",
func(ctx iris.Context) {
ctx.Writef("Lat: %s | Lon: %s", ctx.Params().Get("lat"), ctx.Params().Get("lon"))
})
```
@ -88,7 +89,8 @@ Register your custom macro function which accepts two int arguments.
```go
app.Macros().Get("string").RegisterFunc("range", func(minLength, maxLength int) func(string) bool {
app.Macros().Get("string").RegisterFunc("range",
func(minLength, maxLength int) func(string) bool {
return func(paramValue string) bool {
return len(paramValue) >= minLength && len(paramValue) <= maxLength
}
@ -104,7 +106,8 @@ app.Get("/limitchar/{name:string range(1,200) else 400}", func(ctx iris.Context)
Register your custom macro function which accepts a slice of strings `[...,...]`.
```go
app.Macros().Get("string").RegisterFunc("has", func(validNames []string) func(string) bool {
app.Macros().Get("string").RegisterFunc("has",
func(validNames []string) func(string) bool {
return func(paramValue string) bool {
for _, validName := range validNames {
if validName == paramValue {
@ -116,9 +119,9 @@ app.Macros().Get("string").RegisterFunc("has", func(validNames []string) func(st
}
})
app.Get("/static_validation/{name:string has([kataras,gerasimos,maropoulos])}", func(ctx iris.Context) {
app.Get("/static_validation/{name:string has([kataras,maropoulos])}", func(ctx iris.Context) {
name := ctx.Params().Get("name")
ctx.Writef(`Hello %s | the name should be "kataras" or "gerasimos" or "maropoulos"
ctx.Writef(`Hello %s | the name should be "kataras" or "maropoulos"
otherwise this handler will not be executed`, name)
})
```
@ -156,4 +159,4 @@ func main() {
}
```
> When parameter type is missing then defaults to `string`, therefore `{name:string}` and `{name}` do the same exactly thing.
> When parameter type is missing then it defaults to the `string` one, therefore `{name:string}` and `{name}` refers to the same exactly thing.

@ -9,7 +9,7 @@ There are times that you may need to override or decide whether the Router will
// for the WrapRouter. It's a "low-level" signature which is compatible
// with the net/http.
// It's being used to run or no run the router based on a custom logic.
type WrapperFunc func(w http.ResponseWriter, r *http.Request, firstNextIsTheRouter http.HandlerFunc)
type WrapperFunc func(w http.ResponseWriter, r *http.Request, router http.HandlerFunc)
// WrapRouter adds a wrapper on the top of the main router.
// Usually it's useful for third-party middleware
@ -98,7 +98,8 @@ func main() {
app.Run(iris.Addr(":8080"))
// Note: In this example we just saw one use case,
// you may want to .WrapRouter or .Downgrade in order to bypass the iris' default router, i.e:
// you may want to .WrapRouter or .Downgrade in order to
// bypass the Iris' default router, i.e:
// you can use that method to setup custom proxies too.
}
```

@ -34,8 +34,8 @@ All HTTP methods are supported, developers can also register handlers on the sam
The first parameter is the HTTP Method,
second parameter is the request path of the route,
third variadic parameter should contains one or more iris.Handler executed
by the registered order when a user requests for that specific resouce path from the server.
third variadic parameter should contain one or more `iris.Handler` executed
by the registered order when a client requests for that specific resouce path from the server.
Example code:

@ -7,7 +7,7 @@ Unbeatable free support for the last three years and that is just the beginning
In these difficult and restless days we stand beside you. We do not judge bad english writing.
We are here for you, no matter who you are.
Navigate through the Iris github [repository](https://github.com/kataras/iris) to see by yourself the features and the hard work that we putted to improve how the internet is built.
Navigate through the Iris github [repository](https://github.com/kataras/iris) to see by yourself the features and the hard work that we putted to improve how the web is built.
### Read the latest and greatest features and get migration help
* [HISTORY](https://github.com/kataras/iris/blob/master/HISTORY.md) file is your best friend, it contains the changelog, information about the latest features and changes to the framework.

@ -5,6 +5,6 @@
* [[Routing]]
* [[Path Parameter Types|Routing-path-parameter-types]]
* [[Reverse Lookups|Routing-reverse-lookups]]
* [[Use and Write middleware|Routing-middleware]]
* [[Middleware|Routing-middleware]]
* [[Custom error handlers|Routing-error-handlers]]
* [[Wrap the Router|Routing-wrap-the-router]]