diff --git a/LICENSE b/LICENSE index 1645802c..c9eada50 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 The Iris Authors. All rights reserved. +Copyright (c) 2017-2018 The Iris Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/README.md b/README.md index dba7dc68..fefdd2a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Iris web framework +# Iris Web Framework @@ -18,6 +18,71 @@ Thank you to all our backers! [Become a backer](https://opencollective.com/iris# +```sh +$ cat example.go +``` + +```go +package main + +import "github.com/kataras/iris" + +func main() { + app := iris.New() + // Load all templates from the "./views" folder + // where extension is ".html" and parse them + // using the standard `html/template` package. + app.RegisterView(iris.HTML("./views", ".html")) + + // Method: GET + // Resource: http://localhost:8080 + app.Get("/", func(ctx iris.Context) { + // Bind: {{.message}} with "Hello world!" + ctx.ViewData("message", "Hello world!") + // Render template file: ./views/hello.html + ctx.View("hello.html") + }) + + // Method: GET + // Resource: http://localhost:8080/user/42 + // + // Need to use a custom regexp instead? + // Easy, + // just mark the parameter's type to 'string' + // which accepts anything and make use of + // its `regexp` macro function, i.e: + // app.Get("/user/{id:string regexp(^[0-9]+$)}") + app.Get("/user/{id:long}", func(ctx iris.Context) { + userID, _ := ctx.Params().GetInt64("id") + ctx.Writef("User ID: %d", userID) + }) + + // Start the server using a network address. + app.Run(iris.Addr(":8080")) +} +``` + +> Learn more about path parameter's types by clicking [here](_examples/routing/dynamic-path/main.go#L31) + +```html + + + + Hello Page + + +

{{.message}}

+ + +``` + +```sh +$ go run example.go +Now listening on: http://localhost:8080 +Application Started. Press CTRL+C to shut down. +_ +``` + ## Installation The only requirement is the [Go Programming Language](https://golang.org/dl/) diff --git a/sessions/LICENSE b/sessions/LICENSE index 74d79164..6a39906b 100644 --- a/sessions/LICENSE +++ b/sessions/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 The Iris Sessions Authors. All rights reserved. +Copyright (c) 2017-2018 The Iris Sessions Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/typescript/LICENSE b/typescript/LICENSE index bf0ef637..ec401599 100644 --- a/typescript/LICENSE +++ b/typescript/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 The Iris Typescript Authors. All rights reserved. +Copyright (c) 2017-2018 The Iris Typescript Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/websocket/LICENSE b/websocket/LICENSE index 08f23129..47aea48d 100644 --- a/websocket/LICENSE +++ b/websocket/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2017 The Iris Websocket Authors. All rights reserved. +Copyright (c) 2017-2018 The Iris Websocket Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are