Commit Graph

67 Commits (main)

Author SHA1 Message Date
RW a7bf8171b1
🐛 bug: Fix handler order in routing (#3321)
* fix handler order in routing
#3312

* fix handler order in routing
#3312

* fix handler order in routing
#3312

* fix handler order in routing
#3312

* fix handler order in routing
#3312

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2025-02-24 08:14:19 +01:00
Juan Calderon-Perez 8c3f81e2b7
v3: Use Named Fields Instead of Positional and Align Structures to Reduce Memory Usage (#3079)
* Use composites for internal structures. Fix alignment of structures across Fiber

* Update struct alignment in test files

* Enable alignment check with govet

* Fix ctx autoformat unit-test

* Revert app Config struct. Add betteralign to Makefile

* Disable comment on alert since it wont work for forks

* Update benchmark.yml

* Update benchmark.yml

* Remove warning from using positional fields

* Update router.go
2024-07-23 08:37:45 +02:00
M. Efe Çetin 38fb8064c6
middleware: add static middleware (#3006)
* middleware: add static middleware

* uncomment broken tests

* introduce isfile config property to fix file issues

* test

* add io/fs support to static mw

* add io/fs support to static mw

* remove filesystem and app.Static

* fix linter

* apply review

* support disablecache

* support multi indexes

* add an example for io/fs

* update whats new & apply reviews

* update

* use fasthttp from master

* Update .github/README.md

Co-authored-by: RW <rene@gofiber.io>

* update1

* apply reviews

* update

* update

* update examples

* add more examples

---------

Co-authored-by: RW <rene@gofiber.io>
2024-05-28 09:29:25 +02:00
Muhammed Efe Cetin 75bb02b87e
Merge remote-tracking branch 'origin/master' into v3-beta 2023-08-05 22:02:01 +03:00
Chris Hurst c955d76f5d
🐛 bug: fix middleware naming and returned values of group methods (#2477)
* Bug fix: route names not updating

* fixed lint error

* updated tests with renaming edge case

* fix group naming partially

* add todo

* fix todo

* fix todo

---------

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2023-06-05 13:00:51 +02:00
Muhammed Efe Çetin 088cde594d
Merge remote-tracking branch 'origin/master' into v3-beta 2023-02-05 23:43:42 +03:00
leonklingele 167a8b5e94
🚀 Feature: Add and apply more stricter golangci-lint linting rules (#2286)
* golangci-lint: add and apply more stricter linting rules

* github: drop security workflow now that we use gosec linter inside golangci-lint

* github: use official golangci-lint CI linter

* Add editorconfig and gitattributes file
2023-01-27 09:01:37 +01:00
Muhammed Efe Çetin c62dd16e8d
Merge remote-tracking branch 'origin/master' into v3-beta 2022-11-27 20:34:48 +03:00
M. Efe Çetin 8aeb147c75
feature: add multiple-prefix support to app.Use() and group.Use() (#2205) 2022-11-13 16:56:34 +01:00
Rafi Muhammad 878c9549d8
Feat: Register custom methods (#2107)
* Implementing register custom methods

* Return timout time to 1000

* Update app_test.go

* Change update stack to add custom request method

* Feat: Register custom methods #2107

* Feat: Register custom methods #2107

* update logic

* optimization.

* fix

Co-authored-by: Rafi Muhammad <rafi.muhammad@mekari.com>
Co-authored-by: RW <rene@gofiber.io>
Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-11-11 08:23:30 +01:00
M. Efe Çetin 581af0052d
🐛 bug: fix naming of routes inside groups (#2199)
* 🐛 bug: fix naming of routes inside groups

* fix tests

* bug: fix naming of routes inside groups

Co-authored-by: René Werner <rene@gofiber.io>
2022-11-09 16:03:16 +01:00
Eren BALCI 24fd165660
v3 (feature): new mounting system (#2022)
* 🔥 chore: removed mount from router

*  feat: new mounting system

*  feat: mount for group

*  test: updated and improve for new mount system

* ♻️ refactor: better variable name

* ♻️ refactor: better function naming

* 🐛 fix: not mounted check

*  test: update onmount test if sub app is not mounted to parent

* 🎨 perf: fix allocs problem

*  test: add benchmark for MountPath

*  feat: access to app's mountpath

*  test: remove parent app's mountpath test

* remove some parts

* add comment

* fix

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
Co-authored-by: RW <rene@gofiber.io>
2022-11-03 10:55:31 +01:00
pj 709e0952e2
v3 (feature): router interface changes (#2176)
* Add(methods []string, path string, handlers ...Handler) Router

* - proposed Router interface changes

Co-authored-by: rocketlaunchr-cto <rocketlaunchr.cloud@gmail.com>
2022-11-01 08:45:43 +01:00
Muhammed Efe Çetin 9428befb9c
Merge remote-tracking branch 'origin/master' into v3-beta 2022-10-28 17:26:17 +03:00
M. Efe Çetin 156b81c768
🐛 bug: improve mounting behavior (#2120)
* 🐛 bug: fix mounting doesn't work if when to declare it before routes

* 🐛 bug: fix mounting doesn't work if when to declare it before routes

* 🐛 bug: fix mounting doesn't work if when to declare it before routes

* 🐛 bug: fix mounting doesn't work if when to declare it before routes

* 🐛 bug: fix mounting doesn't work if when to declare it before routes

* add onMount hooks, mountPath like express.js, better behavior for onName, onRoute, onGroup, onGroupName hooks on mounted apps

* add comment

* use once

* fix views when both app and sub-app have view engine, better behavior for mount path

* fix tests

* fix tests

* make some tasks

* make some tasks
2022-10-25 07:51:44 +02:00
Amir Hossein 1d773c7f3c
update code comments for helping IDEs and fix unhandled error in test (#2099)
* fix unhandled errors

* fix unhandled error in cache package test

* omit variable type

* omit variable type

* rename variable because collide with the imported package name

* handle file error on closing

* fix unhandled in common_linux.go

* fix unhandled errors in helpers_test.go

* fix unhandled errors in listen_test.go

* remove unused parameter in emptyHandler method

* refactor path.go

* unhandled error in hooks test

* fix unhandled errors in app_test.go

* fix unhandled errors in ctx_test.go

*  fix unhandled errors in helpers_test.go

* revert app_test.go

* remove redundant parentheses and update comments

* update code comment for helping ide

* update code comment for helping ide

* fix unhandled error in app_test.go

* update code comments for helping IDEs
2022-09-18 15:32:54 +02:00
Jinquan Wang 093882cfdf
v3 (feature): new Route method (#2065)
* 🎨 perf: change name to add new feature

*  feat add route

* 🎨 perf: rollback name

* 🎨 perf: change file name

* fix: fix errors caused by register

* 🎨 perf: change filed to private and change comment

* feat: interface is better

* 🎨 perf: change type name

* deeper tests

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-09-18 11:35:57 +02:00
Muhammed Efe Çetin 78c6197430
♻️ v3 (enhancement): remove automatic HEAD method creation from Get()
ref: https://github.com/gofiber/fiber/issues/2026
2022-09-05 17:41:39 +03:00
Muhammed Efe Çetin 4105b008c2
Merge remote-tracking branch 'origin/master' into v3-beta 2022-08-19 14:33:31 +03:00
M. Efe Çetin 6669ec4486
📝 docs: gofmt & add missing copyright texts (#2013) 2022-08-15 20:25:26 +02:00
M. Efe Çetin a458bd344c
v3 (feature): convert fiber.Ctx type to interface (#1928)
*  v3: convert fiber.Ctx type to interface

* update ctx methods

* add new methods to customize ctx, fix some problems

* update comments.

* fix something
2022-07-13 07:48:29 +02:00
Muhammed Efe Çetin c7f45ec38e
v3: replace interface{}s by any 2022-05-31 17:41:38 +03:00
RW a8f9d4acfb
🐛 Sub fiber's error handlers not working #1839 (#1848)
fix root level bug
2022-04-05 08:40:22 +02:00
M. Efe Çetin bd20e90e6b
feature: add initial support for hooks (#1777)
* Add initial support for hooks.

* release ctx, mutex.

* Add unit tests.

* add comment lines.

* update

* update

* remove unnecessary code.

* fix race condition.

* fix gosec.

* skip error handling for onshutdown and onresponse.

* update

* separate hooks from app.go

* make hooks field private, hook struct public and Hooks() func.

* remove onreq and onres because of they can be done by middlewares.

* OnGroupName method.

* Update hooks.go

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>

* handle errors for name and groupname

* fix tests.

* Update app.go

* use struct fields instead of map

* add multi-handler.

* add onGroup, make prefix field public on Group struct.

* Update hooks.go

* add newhooks method.

*  feature: add initial support for hooks

* remove ctx from hooks.

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
Co-authored-by: wernerr <rene@gofiber.io>
2022-03-10 08:35:15 +01:00
M. Efe Çetin c450072f4a
🐛 fix: mounted app views (#1749)
* Fix mounted app views.

* Cleaner structure.

Co-authored-by: RW <rene@gofiber.io>

* remove unnecessary lines.

* Add test case for group-with-mount, remove unnecessary lines.

Co-authored-by: RW <rene@gofiber.io>
2022-02-06 14:58:45 +01:00
M. Efe Çetin d3c2122086
Fix route naming when to use group in group. (#1736) 2022-01-29 15:26:01 +01:00
M. Efe Çetin 559f59f198
Add Route() method like Chi router. (#1713) 2022-01-24 16:37:28 +01:00
vecpeng ef3a689600
🐛fix: rename handlerCount to handlersCount (#1674) 2021-12-29 10:26:50 +01:00
ichx 637f0c1bba
Fix: error handler of app and its sub apps not saved when mounted in group (#1649) 2021-12-28 14:05:35 +01:00
M. Efe Çetin 68d3b773bc
Add route naming feature. (#1650)
* Add route naming feature.

* Update basicauth_test.go

* Fix gosec issues.

* Change RoutaName -> Name

* Fix race conditions.

* Update READMEs.
2021-12-28 14:04:04 +01:00
Gusted 7b7dcf29f7
♻️ Tidy up the codebase (#1613)
* run gofmt

* add t.Helper()

* Simplify assigns

* Simplify make operation

* Remove unused field in struct

* Fix typo

* Run gofumpt ./

* Consistent spacing

* len(...) can never be negative

* Use ReplaceAll

* Simplify operation

* Remove deadcode

* Fix typo

* Tidy up `} else { if ...`

* Fix AssertEqual

* Remove t.Helper() to fix go1.14.15
2021-11-05 08:00:03 +01:00
bestgopher 056c6808af
Use atomic instead of mutex when counting the route handler. (#1314)
* use atomic instead of mutex when counting

* 📒 router: fix typo error
2021-05-05 17:53:54 +02:00
Dario Leittersdorf a28afaae75
🩹Fix: Startup message doesn't show correct amount of Handlers after mounting (#1302)
* fix: pass handlerCount when mounting to an App

* test: check for correct handlerCount after mounting an instance

* fix: pass handlerCount when mounting to a Group

* test: check for correct handlerCount after mounting to a Group

Co-authored-by: dleitter <dario.leittersdorf@bonprix.net>
2021-05-04 09:21:04 +02:00
Kiyon d6d831e2b1 👷 fix lint 2020-11-30 13:49:13 +08:00
kiyon 839c8f1447 👷 fix group.Mount 2020-10-04 00:36:11 +08:00
Fenny 753391b217 🧹 remove old code 2020-09-26 11:25:32 +02:00
Fenny e414c4a83e 🗻 able to mount sub-apps 2020-09-26 11:24:25 +02:00
Fenny ca9c8c632f v2
Co-Authored-By: hi019 <65871571+hi019@users.noreply.github.com>
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
Co-Authored-By: kiyon <kiyon@gofiber.io>
Co-Authored-By: Roger Guldbrandsen <8797880+kinbiko@users.noreply.github.com>
2020-09-14 08:05:34 +02:00
Fenny 3d76f078a4 v2 2020-09-14 04:54:26 +02:00
Fenny ec5d66e7a8 v2 2020-09-13 11:20:11 +02:00
wernerr b9bdc0d4a8 🚀 compress same route's handler 2020-07-20 19:29:54 +02:00
kiyon 174eb0e33d 🚀 compress same route's handler and sort routes when registering 2020-07-20 21:43:01 +08:00
Fenny f9e6ea8103 🖇 Cleanup router chaining 2020-07-19 13:36:26 +02:00
ReneWerner87 1b2d3d92c4 🔗Allow route method chaining
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/express-serve-static-core/index.d.ts#L119-L126
2020-07-19 10:04:21 +02:00
Fenny da85c85c14 🧪 Increase test coverage: 96% 2020-07-15 17:43:30 +02:00
kiyon 2cfc1b1546 👷 Extract "USE" to a global const variable 2020-07-12 23:54:22 +08:00
Fenny 7ea6b2a9d0 🧩 Describe HTTP methods 2020-07-06 17:56:03 +02:00
ReneWerner87 d57651835b improve routing performance 2020-06-29 22:51:41 +02:00
wernerr f1710ea1b6 fix the unnecessary pass through for routes with groups 2020-06-19 10:54:15 +02:00
fenny e8b8fdfb35
Add Handler type (#410)
* Add new supporter
* Add new test condition
* Add Handler Type
2020-05-24 16:02:21 +02:00