Skip to content

Commit f2c027e

Browse files
FennythomasvvugtQueruReneWerner87
authored
Small changes (#415)
* Update template examples * Update fasthttp to v1.13.1 Co-Authored-By: Thomas van Vugt <thomasvvugt@users.noreply.github.com> * Cookie SameSite defaults to Lax Co-Authored-By: Thomas van Vugt <thomasvvugt@users.noreply.github.com> Co-Authored-By: Queru <pascal@queru.net> * Fix router bug Co-Authored-By: RW <renewerner87@googlemail.com> * Remove unused code Co-Authored-By: RW <renewerner87@googlemail.com> Co-authored-by: Thomas van Vugt <thomasvvugt@users.noreply.github.com> Co-authored-by: Queru <pascal@queru.net> Co-authored-by: RW <renewerner87@googlemail.com>
1 parent 02b4061 commit f2c027e

19 files changed

+189
-247
lines changed

.github/README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ These tests are performed by [TechEmpower](https://github.com/TechEmpower/Framew
121121
- [API endpoints](https://docs.gofiber.io/context)
122122
- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/context#next) support
123123
- [Rapid](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming
124-
- [Template engines](https://docs.gofiber.io/middleware#template)
124+
- [Template engines](https://github.com/gofiber/template)
125125
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
126126
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
127127
- Translated in [12 other languages](https://docs.gofiber.io/)
@@ -180,11 +180,11 @@ func main() {
180180
func main() {
181181
app := fiber.New()
182182

183-
app.Static("/", "/public")
183+
app.Static("/", "./public")
184184
// => http://localhost:3000/js/script.js
185185
// => http://localhost:3000/css/style.css
186186

187-
app.Static("/prefix", "/public")
187+
app.Static("/prefix", "./public")
188188
// => http://localhost:3000/prefix/js/script.js
189189
// => http://localhost:3000/prefix/css/style.css
190190

@@ -232,35 +232,31 @@ func main() {
232232
### Template engines
233233

234234
📖 [Settings](https://docs.gofiber.io/application#settings)
235+
📖 [Template Engines](https://github.com/gofiber/template)
235236
📖 [Render](https://docs.gofiber.io/context#render)
236-
📖 [Template](https://docs.gofiber.io/middleware#template)
237237

238-
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
238+
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
239239

240-
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
240+
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
241241

242-
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
242+
You can use our [Template Middleware](https://github.com/gofiber/template).
243243

244244
```go
245245
import (
246246
"github.com/gofiber/fiber"
247-
"github.com/gofiber/template"
247+
"github.com/gofiber/template/pug"
248248
)
249249

250250
func main() {
251251
// You can setup template engine before initiation app:
252252
app := fiber.New(&fiber.Settings{
253-
TemplateEngine: template.Mustache(),
254-
TemplateFolder: "./views",
255-
TemplateExtension: ".tmpl",
253+
Templates: pug.New("./views", ".pug"),
256254
})
257255

258256
// OR after initiation app at any convenient location:
259-
app.Settings.TemplateEngine = template.Mustache()
260-
app.Settings.TemplateFolder = "./views"
261-
app.Settings.TemplateExtension = ".tmpl"
257+
app.Settings.Templates = pug.New("./views", ".pug"),
262258

263-
// And now, you can call template `./views/home.tmpl` like this:
259+
// And now, you can call template `./views/home.pug` like this:
264260
app.Get("/", func(c *fiber.Ctx) {
265261
c.Render("home", fiber.Map{
266262
"title": "Homepage",
@@ -357,7 +353,7 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000
357353
func main() {
358354
app := fiber.New()
359355

360-
app.Static("/public")
356+
app.Static("./public")
361357

362358
app.Get("/demo", func(c *fiber.Ctx) {
363359
c.Send("This is a demo!")

.github/README_ar_SA.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ go get -u github.com/gofiber/fiber
135135
- [API endpoints](https://docs.gofiber.io/context)
136136
- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/context#next) مدعوم
137137
- [سريع](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) server-side programming
138-
- [Template engines](https://docs.gofiber.io/middleware#template)
138+
- [Template engines](https://github.com/gofiber/template)
139139
- [WebSocket دعم](https://docs.gofiber.io/middleware#websocket)
140140
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
141141
- ترجم الى [12 لغة أخرى](https://docs.gofiber.io/)
@@ -201,11 +201,11 @@ func main() {
201201
func main() {
202202
app := fiber.New()
203203

204-
app.Static("/", "/public")
204+
app.Static("/", "./public")
205205
// => http://localhost:3000/js/script.js
206206
// => http://localhost:3000/css/style.css
207207

208-
app.Static("/prefix", "/public")
208+
app.Static("/prefix", "./public")
209209
// => http://localhost:3000/prefix/js/script.js
210210
// => http://localhost:3000/prefix/css/style.css
211211

@@ -258,37 +258,34 @@ func main() {
258258
### Template engines
259259

260260
📖 [Settings](https://docs.gofiber.io/application#settings)
261+
📖 [Template Engines](https://github.com/gofiber/template)
261262
📖 [Render](https://docs.gofiber.io/context#render)
262-
📖 [Template](https://docs.gofiber.io/middleware#template)
263263

264-
Fiber يدعم وبشكل افتراضي [Go template engine](https://golang.org/pkg/html/template/)
264+
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
265265

266-
ولكن إذا كنت ترغب في استخدام محرك قالب آخر مثل [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) او [pug](https://github.com/Joker/jade).
266+
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
267+
268+
You can use our [Template Middleware](https://github.com/gofiber/template).
267269

268-
يمكنك استخدام [Template Middleware](https://docs.gofiber.io/middleware#template).
269270

270271
<div dir="ltr" >
271272

272273
```go
273274
import (
274275
"github.com/gofiber/fiber"
275-
"github.com/gofiber/template"
276+
"github.com/gofiber/template/pug"
276277
)
277278

278279
func main() {
279280
// You can setup template engine before initiation app:
280281
app := fiber.New(&fiber.Settings{
281-
TemplateEngine: template.Mustache(),
282-
TemplateFolder: "./views",
283-
TemplateExtension: ".tmpl",
282+
Templates: pug.New("./views", ".pug"),
284283
})
285284

286285
// OR after initiation app at any convenient location:
287-
app.Settings.TemplateEngine = template.Mustache()
288-
app.Settings.TemplateFolder = "./views"
289-
app.Settings.TemplateExtension = ".tmpl"
286+
app.Settings.Templates = pug.New("./views", ".pug"),
290287

291-
// And now, you can call template `./views/home.tmpl` like this:
288+
// And now, you can call template `./views/home.pug` like this:
292289
app.Get("/", func(c *fiber.Ctx) {
293290
c.Render("home", fiber.Map{
294291
"title": "Homepage",
@@ -406,7 +403,7 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000
406403
func main() {
407404
app := fiber.New()
408405

409-
app.Static("/public")
406+
app.Static("./public")
410407

411408
app.Get("/demo", func(c *fiber.Ctx) {
412409
c.Send("This is a demo!")

.github/README_de.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Diese Tests wurden von [TechEmpower](https://github.com/TechEmpower/FrameworkBen
121121
- Express [API Endpunkte](https://docs.gofiber.io/context)
122122
- [Middleware](https://docs.gofiber.io/middleware) & [Next](https://docs.gofiber.io/context#next) Support
123123
- [Schnelle](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) serverseitige Programmierung
124-
- [Template engines](https://docs.gofiber.io/middleware#template)
124+
- [Template engines](https://github.com/gofiber/template)
125125
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
126126
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
127127
- Available in [12 languages](https://docs.gofiber.io/)
@@ -176,11 +176,11 @@ func main() {
176176
func main() {
177177
app := fiber.New()
178178

179-
app.Static("/", "/public")
179+
app.Static("/", "./public")
180180
// => http://localhost:3000/js/script.js
181181
// => http://localhost:3000/css/style.css
182182

183-
app.Static("/prefix", "/public")
183+
app.Static("/prefix", "./public")
184184
// => http://localhost:3000/prefix/js/script.js
185185
// => http://localhost:3000/prefix/css/style.css
186186

@@ -228,35 +228,31 @@ func main() {
228228
### Template engines
229229

230230
📖 [Settings](https://docs.gofiber.io/application#settings)
231+
📖 [Template Engines](https://github.com/gofiber/template)
231232
📖 [Render](https://docs.gofiber.io/context#render)
232-
📖 [Template](https://docs.gofiber.io/middleware#template)
233233

234-
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
234+
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
235235

236-
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
236+
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
237237

238-
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
238+
You can use our [Template Middleware](https://github.com/gofiber/template).
239239

240240
```go
241241
import (
242242
"github.com/gofiber/fiber"
243-
"github.com/gofiber/template"
243+
"github.com/gofiber/template/pug"
244244
)
245245

246246
func main() {
247247
// You can setup template engine before initiation app:
248248
app := fiber.New(&fiber.Settings{
249-
TemplateEngine: template.Mustache(),
250-
TemplateFolder: "./views",
251-
TemplateExtension: ".tmpl",
249+
Templates: pug.New("./views", ".pug"),
252250
})
253251

254252
// OR after initiation app at any convenient location:
255-
app.Settings.TemplateEngine = template.Mustache()
256-
app.Settings.TemplateFolder = "./views"
257-
app.Settings.TemplateExtension = ".tmpl"
253+
app.Settings.Templates = pug.New("./views", ".pug"),
258254

259-
// And now, you can call template `./views/home.tmpl` like this:
255+
// And now, you can call template `./views/home.pug` like this:
260256
app.Get("/", func(c *fiber.Ctx) {
261257
c.Render("home", fiber.Map{
262258
"title": "Homepage",
@@ -353,7 +349,7 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000
353349
func main() {
354350
app := fiber.New()
355351

356-
app.Static("/public")
352+
app.Static("./public")
357353

358354
app.Get("/demo", func(c *fiber.Ctx) {
359355
c.Send("This is a demo!")

.github/README_es.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Estas pruebas son realizadas por [TechEmpower](https://github.com/TechEmpower/Fr
121121
- [Puntos finales de API](https://docs.gofiber.io/context) Express
122122
- Middleware y [próximo](https://docs.gofiber.io/context#next) soporte
123123
- Programación [rápida](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497) del lado del servidor
124-
- [Template engines](https://docs.gofiber.io/middleware#template)
124+
- [Template engines](https://github.com/gofiber/template)
125125
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
126126
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
127127
- Disponible en [12 idiomas](https://docs.gofiber.io/)
@@ -176,11 +176,11 @@ func main() {
176176
func main() {
177177
app := fiber.New()
178178

179-
app.Static("/", "/public")
179+
app.Static("/", "./public")
180180
// => http://localhost:3000/js/script.js
181181
// => http://localhost:3000/css/style.css
182182

183-
app.Static("/prefix", "/public")
183+
app.Static("/prefix", "./public")
184184
// => http://localhost:3000/prefix/js/script.js
185185
// => http://localhost:3000/prefix/css/style.css
186186

@@ -228,35 +228,31 @@ func main() {
228228
### Template engines
229229

230230
📖 [Settings](https://docs.gofiber.io/application#settings)
231+
📖 [Template Engines](https://github.com/gofiber/template)
231232
📖 [Render](https://docs.gofiber.io/context#render)
232-
📖 [Template](https://docs.gofiber.io/middleware#template)
233233

234-
Fiber soporta el [Go template engine](https://golang.org/pkg/html/template/) por default.
234+
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
235235

236-
Pero si deseas usar otro template engine como [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) o [pug](https://github.com/Joker/jade).
236+
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
237237

238-
Puedes usar nuestro [Template Middleware](https://docs.gofiber.io/middleware#template).
238+
You can use our [Template Middleware](https://github.com/gofiber/template).
239239

240240
```go
241241
import (
242242
"github.com/gofiber/fiber"
243-
"github.com/gofiber/template"
243+
"github.com/gofiber/template/pug"
244244
)
245245

246246
func main() {
247247
// You can setup template engine before initiation app:
248248
app := fiber.New(&fiber.Settings{
249-
TemplateEngine: template.Mustache(),
250-
TemplateFolder: "./views",
251-
TemplateExtension: ".tmpl",
249+
Templates: pug.New("./views", ".pug"),
252250
})
253251

254252
// OR after initiation app at any convenient location:
255-
app.Settings.TemplateEngine = template.Mustache()
256-
app.Settings.TemplateFolder = "./views"
257-
app.Settings.TemplateExtension = ".tmpl"
253+
app.Settings.Templates = pug.New("./views", ".pug"),
258254

259-
// And now, you can call template `./views/home.tmpl` like this:
255+
// And now, you can call template `./views/home.pug` like this:
260256
app.Get("/", func(c *fiber.Ctx) {
261257
c.Render("home", fiber.Map{
262258
"title": "Homepage",
@@ -353,7 +349,7 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000
353349
func main() {
354350
app := fiber.New()
355351

356-
app.Static("/public")
352+
app.Static("./public")
357353

358354
app.Get("/demo", func(c *fiber.Ctx) {
359355
c.Send("This is a demo!")

.github/README_fr.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Ces tests sont effectués par [TechEmpower](https://github.com/TechEmpower/Frame
121121
- [API endpoints](https://docs.gofiber.io/context)
122122
- Middleware & [Next](https://docs.gofiber.io/context#next) support
123123
- Programmation côté serveur [rapide](https://dev.to/koddr/welcome-to-fiber-an-express-js-styled-fastest-web-framework-written-with-on-golang-497)
124-
- [Template engines](https://docs.gofiber.io/middleware#template)
124+
- [Template engines](https://github.com/gofiber/template)
125125
- [WebSocket support](https://docs.gofiber.io/middleware#websocket)
126126
- [Rate Limiter](https://docs.gofiber.io/middleware#limiter)
127127
- Available in [12 languages](https://docs.gofiber.io/)
@@ -176,11 +176,11 @@ func main() {
176176
func main() {
177177
app := fiber.New()
178178

179-
app.Static("/", "/public")
179+
app.Static("/", "./public")
180180
// => http://localhost:3000/js/script.js
181181
// => http://localhost:3000/css/style.css
182182

183-
app.Static("/prefix", "/public")
183+
app.Static("/prefix", "./public")
184184
// => http://localhost:3000/prefix/js/script.js
185185
// => http://localhost:3000/prefix/css/style.css
186186

@@ -228,35 +228,31 @@ func main() {
228228
### Template engines
229229

230230
📖 [Settings](https://docs.gofiber.io/application#settings)
231+
📖 [Template Engines](https://github.com/gofiber/template)
231232
📖 [Render](https://docs.gofiber.io/context#render)
232-
📖 [Template](https://docs.gofiber.io/middleware#template)
233233

234-
Fiber supports the default [Go template engine](https://golang.org/pkg/html/template/)
234+
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
235235

236-
But if you want to use another template engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade).
236+
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
237237

238-
You can use our [Template Middleware](https://docs.gofiber.io/middleware#template).
238+
You can use our [Template Middleware](https://github.com/gofiber/template).
239239

240240
```go
241241
import (
242242
"github.com/gofiber/fiber"
243-
"github.com/gofiber/template"
243+
"github.com/gofiber/template/pug"
244244
)
245245

246246
func main() {
247247
// You can setup template engine before initiation app:
248248
app := fiber.New(&fiber.Settings{
249-
TemplateEngine: template.Mustache(),
250-
TemplateFolder: "./views",
251-
TemplateExtension: ".tmpl",
249+
Templates: pug.New("./views", ".pug"),
252250
})
253251

254252
// OR after initiation app at any convenient location:
255-
app.Settings.TemplateEngine = template.Mustache()
256-
app.Settings.TemplateFolder = "./views"
257-
app.Settings.TemplateExtension = ".tmpl"
253+
app.Settings.Templates = pug.New("./views", ".pug"),
258254

259-
// And now, you can call template `./views/home.tmpl` like this:
255+
// And now, you can call template `./views/home.pug` like this:
260256
app.Get("/", func(c *fiber.Ctx) {
261257
c.Render("home", fiber.Map{
262258
"title": "Homepage",
@@ -353,7 +349,7 @@ curl -H "Origin: http://example.com" --verbose http://localhost:3000
353349
func main() {
354350
app := fiber.New()
355351

356-
app.Static("/public")
352+
app.Static("./public")
357353

358354
app.Get("/demo", func(c *fiber.Ctx) {
359355
c.Send("This is a demo!")

0 commit comments

Comments
 (0)